Skip to main content

Module compaction

Module compaction 

Source
Expand description

Slab compaction — removes unreferenced drops from a slab without re-reading file contents. Preserves codecs, drop identities, and metadata; only the slab and manifest’s slab index / history change.

§Algorithm

  1. Parse the source manifest’s prefix (header, flags, metadata reference — these are copied verbatim).
  2. Walk the metadata blob to find all referenced DropIds.
  3. Load the source slab, extract referenced drops with their compressed bytes and codec (no decompression needed).
  4. Build a new slab containing only the referenced drops.
  5. Re-encode the slab index + history.
  6. Recompute the Merkle root.

Structs§

CompactionResult
Result of compacting an image.

Enums§

CompactionError
Error during compaction.

Functions§

compact_image
Compact an image by removing unreferenced drops from its slab. The manifest’s metadata, header, and flags are preserved; only the slab and the slab index / history sections are updated.