Skip to main content

encode_changeset

Function encode_changeset 

Source
pub fn encode_changeset(
    page_size: u32,
    pages: &mut [PageEntry],
) -> Result<Vec<u8>>
Expand description

Encode pages into a deterministic changeset byte stream.

Canonicalization rule:

  • sort pages by (page_number, page_xxh3, page_bytes) before encoding.
  • this removes non-deterministic map-iteration effects from changeset_bytes.

The encoded stream is self-delimiting via the total_len field in the header.

ยงErrors

Returns error if page_size is 0 or pages are empty.