Message Protocol
Last updated
Was this helpful?
Last updated
Was this helpful?
This section describes the message design between nodes, including message exchange formats and protocols.
is the message exchange format between nodes. protobuf is a flexible and efficient data serialization method for structured data. It has the advantage of high-speed efficiency and space efficiency, e.g., small encode volume, fast encoding and decoding speed.
A general message is the information that must be carried in all node communication. The message includes the following details of a peer node: version number, timestamp, message ID, whether to gossip this message to neighboring nodes, node ID, node public key, and node data signature. The primary function of a general message is to verify the node's identity and data signature. The general message protocol design is as follows:
The write data message protocol describes how a node writes its data to another node, including request and response message formats. The write data message protocol is defined as follows:
WritefileRequest
defines the data offset of writing, which enables breakpoint and continuation setup in the writing process. As long as the peer informs the writer about the offset in WritefileResponse
message, the writer can start writing from the position specified by the offset without having to start writing from the starting position every time.
The read data message protocol describes how a node reads the desired data from another node, including request and response message formats. The read data message protocol is defined as follows:
ReadfileRequest
defines the data offset of reading, which enables breakpoint and continuation setup in the reading process. As long as the reader informs the peer about the offset in ReadfileResponse
message, the peer can start reading from the position specified by the offset.