module

Raft::RPC::Codec

TLV (Type-Length-Value) binary serialization for Raft RPC messages.

Wire format: [type: 1 byte][length: 4 bytes BigEndian][payload: N bytes]

Strings are length-prefixed with UInt16 BE, byte arrays with UInt32 BE, booleans as a single byte (0 or 1), and integers as big-endian fixed-width.

Class methods

decode(io : IO) : Message

Reads a TLV frame from io and returns the decoded RPC message.

Raises Raft::Error on unexpected EOF or unknown type tag.

Source
encode(message : Message, io : IO) : Nil

Encodes an RPC message as a TLV frame and writes it to io.

Source
encode(message : Message) : Bytes

Encodes an RPC message and returns the TLV frame as Bytes.

Source