Skip to main content

Module serialize

Module serialize 

Source
Expand description

Canonical byte (de)serialization for Object.

Spec: docs/SPEC-OBJECTS.md. The byte layout produced here is the v1 on-disk format; the golden-vector tests in tests/golden.rs pin it byte-for-byte.

Every deserializer:

  • Validates the 6-byte v1 prologue first.
  • Enforces per-type bounds (entry counts, identity len, etc.).
  • Rejects non-empty trailing bytes via MkitError::TrailingData.

Constants§

MAX_TREE_ENTRIES
Decode-side cap on tree entry count; writers (and the git importer) must refuse anything larger or the store gains an undecodable signed object.

Functions§

blob_prologue
The exact byte prefix of serialize(Object::Blob(..)) for a payload of len bytes: 6-byte object prologue plus the u32 LE data length. Lets ingest write a chunk as prologue ‖ payload straight from the source buffer — no Blob allocation, no serialize copy. Equivalence with serialize is pinned by proptest and, transitively, the golden blob vectors.
deserialize
Deserialize bytes into an owned Object. Validates the prologue and every per-type bound; rejects trailing data.
serialize
Serialize an Object to its canonical byte form. Allocates fresh each call; the result is fully owned.