Project

General

Profile

Tcp Bulk Insert Repo Insertion Protocol » History » Version 2

weijia yuan, 02/26/2018 07:29 PM

1 1 weijia yuan
Tcp Bulk Insert Repo Insertion Protocol
2
====================================
3 2 weijia yuan
4
Tcp Bulk Insert Repo Insertion Protocol is a special part of the repo insertion protocol.
5
6
When repo and producer run on  the same host, we can use TCP bulk to directly insert data in to repo storage. 
7
8
## Basic operations
9
10
### Listen
11
12
Listen is a initial repo operation. Repo first listens on a TCP socket by invoking listen(). The information of host and port number are passed as parameters. The whole insertion is an async process, and main thread will keep listening and assigning tasks to different child thread. 
13
14
### Handle
15
Handle includes 2 operations.: handleAccept, handleReceive. HandleAccept() is a callback function of listen(). It will accept the connection from socket, and prepare accepting the next connection after this process. After finishing the connection, HandleReceive will be called to analyze data package. 
16
17
### StartReceive
18
Initiate the handleReceive function and prepare async receive.
19
20
ProcessId is a random number generated by client to indicate the deletion process. Repo will match this ProcessId with this deletion process.