pub fn encode_chained_ops_record(
shard_id: u32,
lsn: u64,
ops: &[Op],
command_payload: Option<&[u8]>,
max_record_bytes: usize,
) -> Vec<Vec<u8>>Expand description
Split ops (optionally paired with command_payload) into one or more
framed WAL records at (shard_id, lsn), each a complete, independently
checksummed frame whose total length never exceeds max_record_bytes.
All returned records share one LSN; only the last is tagged
[OPS_RECORD_KIND_CHAIN_FINAL] (or, when everything already fits in one
record — overwhelmingly the common case — the single returned record is
byte-identical to encode_ops_record’s ordinary BARE/WITH_COMMAND
output). When chaining is needed, the logical body (op-set plus optional
command, laid out exactly like WITH_COMMAND’s own format) is cut at
arbitrary raw byte boundaries — never aligned to op or command
boundaries — which is what lets a command payload of any size be chained
too, not just the op-set: nothing is decoded fragment-by-fragment, only
once every fragment of the chain is reassembled (see ChainAssembler).
§Panics
Panics if max_record_bytes is too small to fit even the frame header
and kind byte — a caller-side configuration error, not a data-dependent
runtime condition.