Module transport

Source
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ยง

ChannelHandler
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.
NoopMetrics
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.