Currently in testing: the GitHub code will be opened once complete.

Frame Structure

The length-prefixed binary framing that carries Raft RPCs. Unlike the client protocol's \n-terminated frames, the length is sent first and that many bytes are then read. Request-response pairs on a connection go back and forth sequentially, and the dialing side is always the requester.

Request (dialer → receiver)

Structurerefresh

Response (receiver → dialer)

Structurerefresh
FieldSizeContent
tagu8RPC type — see RPC Types (request only)
lenu32, big-endianByte length of the payload that follows
payloadlen bytesAn openraft type serialized in postcard format

Connection Management Rules

  • len is capped at 64 MiB (checked on receipt). Any frame over the limit, a malformed frame, an unknown tag, or a Raft processing error are all handled by closing the connection — the dialing side (openraft) reconnects and retries.
  • The dialing side reuses one connection per target node. On an I/O error, or if a round trip is cancelled partway through, that connection is discarded and a fresh one is dialed on the next call — a half-read stream is never reused in a misaligned state.

Terminology

  • length-prefix — framing that sends the body's length first, then reads exactly that many bytes. No delimiter like \n is needed, so arbitrary binary data can be carried as-is.
  • serialization — turning an in-memory struct into a byte sequence suitable for transport.
  • RPC (remote procedure call) — a request-response pair that calls a function on another server over the network, as if calling it locally.