Skip to main content

Module bundle

Module bundle 

Source
Expand description

Portable, deterministic document-store bundle (*.zenithbundle).

§Format

[8 bytes]  magic: b"ZNBDL1\0\0"  (written raw, NOT compressed)
[remaining] single DEFLATE stream (flate2 ZlibEncoder/ZlibDecoder,
            pure-Rust miniz_oxide backend) over the following payload:

  doc_id        : u32 LE length  +  UTF-8 bytes
  entry_count   : u32 LE
  for each entry (sorted ascending by relative path bytes):
    rel_path    : u32 LE length  +  UTF-8 bytes
                  (forward-slash separated; relative to doc_dir)
    content     : u64 LE length  +  raw bytes

All integers are little-endian. Determinism is guaranteed by collecting all (relative_path, content) pairs from a depth-first walk of doc_dir, then sorting the collected Vec by relative path bytes before serialising. No timestamps or filesystem metadata are included.

unbundle writes are not transactional: a partial write is possible if the process is killed mid-way. A future unit may stage into a temp dir and rename for atomicity.

Functions§

bundle
Pack a document’s entire store directory into one portable, deterministic byte blob.
unbundle
Reconstruct a document’s store directory from a bundle blob.