pub fn canonical_manifest_bytes(body: &ManifestBody) -> Vec<u8> ⓘExpand description
Deterministic byte encoding of a manifest body.
This is the preimage the hash chain covers. The writer and the verifier both call this function, and a disagreement between them makes every archive written under the older encoding fail verification with no way to tell tampering from a format change.
Every integer is big-endian, every length prefix is a u64, and every
string is UTF-8. Every variable-length field carries a length, so no two
distinct bodies encode to the same bytes.
MANIFEST_BODY_DOMAIN
format_version:u32
len+topic topic_id:16 partition:i32 segment_id:16
start_offset:i64 end_offset:i64 max_timestamp_ms:i64
broker_id:i32 event_timestamp_ms:i64 segment_size_bytes:i64
leader_epochs.len():u64, then per entry in BTreeMap order: epoch:i32 offset:i64
txn_index_empty:u8
objects.len():u64, then per entry in vec order:
len+suffix len+key size_bytes:u64 sha256:32
e_tag: 0u8 | (1u8 len+value)
version_id: 0u8 | (1u8 len+value)
create_precondition:u8 (format version >= 2 only)
epoch_id:16 seq:u64 prev_head:32