module
Raft::RPC::Codec
Overview
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.
Defined in:
raft/rpc/codec.crClass Method Summary
-
.decode(io : IO) : Message
Reads a TLV frame from io and returns the decoded RPC message.
-
.encode(message : Message, io : IO) : Nil
Encodes an RPC message as a TLV frame and writes it to io.
-
.encode(message : Message) : Bytes
Encodes an RPC message and returns the TLV frame as
Bytes.
Class Method Detail
Reads a TLV frame from io and returns the decoded RPC message.
Raises Raft::Error on unexpected EOF or unknown type tag.
Encodes an RPC message as a TLV frame and writes it to io.
Encodes an RPC message and returns the TLV frame as Bytes.