distribute/handshake/messages
Handshake protocol message types
This module defines the message types used during the handshake protocol between nodes in a distributed system. These messages facilitate capability negotiation and connection establishment.
Protocol Flow
- Initiator sends
Hellowith node info and capabilities - Responder replies with
CapabilitiesorReject - If compatible, Responder sends
Acceptwith agreed protocol/version - Connection is established
Example
let hello = Hello(
node_info: "node@host:9000",
capabilities: my_capabilities,
)
Types
Connection acceptance message.
Sent when the handshake is successful and both nodes agree on a protocol and version to use for communication.
pub type Accept {
Accept(protocol: String, version: Int)
}
Constructors
-
Accept(protocol: String, version: Int)
Capability advertisement message.
Sent by the responder to share its own capabilities after receiving
a Hello message. Used during capability negotiation to find
a common protocol version and features.
pub type Capabilities {
Capabilities(capabilities: List(capability.Capability))
}
Constructors
-
Capabilities(capabilities: List(capability.Capability))
Initial handshake message sent by the initiator.
Contains the node’s identity information and its advertised capabilities. The responder uses this to determine compatibility and decide whether to accept or reject the connection.
pub type Hello {
Hello(
node_info: String,
capabilities: List(capability.Capability),
)
}
Constructors
-
Hello( node_info: String, capabilities: List(capability.Capability), )