Skip to main content

Module serde

Module serde 

Source
Expand description

Binary serialization for shard trees and checkpoints.

Shared between crate::kv_shard_store and any future persistence layer.

§Shard format

[version: u8 = 1]
[tree: node]

node :=
  0x00                                -- Nil
  0x01 [hash: 32 bytes] [flags: u8]   -- Leaf
  0x02 [has_ann: u8] [hash: 32 bytes if has_ann=1] [left: node] [right: node]  -- Parent

§Checkpoint format

[has_position: u8]  [position: u64 LE if has_position=1]
[marks_count: u32 LE]  [mark_position: u64 LE] × marks_count

Functions§

read_checkpoint
Deserialize a checkpoint blob produced by write_checkpoint.
read_shard_vote
Deserialize a shard blob produced by write_shard_vote.
write_checkpoint
Serialize a Checkpoint to bytes.
write_shard_vote
Serialize a PrunableTree<MerkleHashVote> to a versioned blob.