Skip to main content

Module header

Module header 

Source
Expand description

RPC frame header layout and framing helpers.

§Current layout (18 bytes)

┌─────────┬──────────┬────────────┬──────────┬───────────────┬─────────────────────┐
│ version │ rpc_type │ payload_len│ crc32c   │ cluster_epoch │ rkyv payload bytes  │
│  1 byte │  1 byte  │  4 bytes   │ 4 bytes  │   8 bytes LE  │  payload_len bytes  │
└─────────┴──────────┴────────────┴──────────┴───────────────┴─────────────────────┘

Every frame is emitted with RPC_FRAME_VERSION in the version byte. Frames with any other version byte are rejected immediately.

Constants§

HEADER_SIZE
Header size in bytes: version(1) + rpc_type(1) + payload_len(4) + crc32c(4) + cluster_epoch(8).
MAX_RPC_PAYLOAD_SIZE
Maximum RPC message payload size (64 MiB). Distinct from WAL’s MAX_RPC_PAYLOAD_SIZE.

Functions§

frame_size
Return the total frame size for a buffer that starts with a valid header.
parse_frame
Validate the CRC32C of an inbound frame and return the payload slice.
write_frame
Write a framed v3 header + payload into out.