Skip to main content

Module command_codec

Module command_codec 

Source
Expand description

Binary codec of command::CommitBatch for the WAL, outcome payloads and replication. The one binary encoding of a CommitBatch (SD-7.3): WAL command envelopes, retry-outcome payloads and replication records all carry these bytes.

The wire format is postcard’s (specified, stable since 1.0): varint integers, length-prefixed byte strings, enum variants by index, no field names. Byte keys therefore cost their length plus one or two bytes, not a JSON list of decimal numbers (the JSON command was ~3 KB per ingested record and 80% of WAL bytes). Changing a command type changes the format; COMMAND_VERSION is bumped with it.

Structs§

CommandCodecError
Malformed command bytes.

Functions§

decode
Decode command bytes produced by encode. Trailing bytes are an error: a command is always exactly one batch.
encode
Encode batch.