Expand description
The Cluster Transport Protocol (CTP).
CTP is the protocol used to transmit commands from controllers to replicas and responses from replicas to controllers. It runs on top of a reliable bidirectional connection stream, as provided by TCP or UDS, and adds message framing as well as heartbeating.
CTP supports any message type that implements the serde Serialize
and Deserialize
traits. Messages are encoded using the bincode
format and then sent over the wire with a
length prefix.
A CTP server only serves a single client at a time. If a new client connects while a connection is already established, the previous connection is canceled.
Modulesยง
- metrics ๐
- Metrics support for the Cluster Transport Protocol.
Structsยง
- Channel
Handler - A connection handler that simply forwards messages over channels.
- Client
- A client for a CTP connection.
- Connection ๐
- An active CTP connection.
- Hello ๐
- A message for exchanging compatibility information during the CTP handshake.
- Noop
Metrics - No-op
Metrics
implementation that ignores all events.
Traitsยง
- Message
- Trait for messages that can be sent over CTP.
- Metrics
- A trait for types that observe connection metric events.
Functionsยง
- handshake ๐
- Perform the CTP handshake.
- host_
from_ ๐address - Helper function to extract the host part from an address string.
- read_
message ๐ - Read a message from the given reader.
- serve
- Spawn a CTP server that serves connections at the given address.
- serve_
connection ๐ - Serve a single CTP connection.
- wire_
decode ๐ - Decode a wire frame back into a message.
- wire_
encode ๐ - Encode a message for wire transport.
- write_
message ๐ - Write a message into the given writer.