Expand description
Content-defined chunking of the manifest’s key stream
(docs/plans/flint-lean-chunked-manifest-design.md §3).
The pointer layout made a TAKEOVER cheap; it did nothing for a publish, which still writes every entry of the project to change one file. Splitting the sorted key stream into immutable, content- addressed chunks makes a publish rewrite only what it touched.
Everything here is pure and synchronous on purpose: the boundary rule is part of the on-the-wire format, and a format decision that can only be exercised through a store is one nobody tests properly.
Structs§
Constants§
- CHUNK_
MAX - Ceiling, so one pathological run cannot recreate the single-object problem this exists to remove.
- CHUNK_
MIN - Floor. Hash boundaries are geometrically distributed, so without one a project accumulates many tiny objects.
- CHUNK_
TARGET - Entries per chunk, in expectation. ~1 MiB of compact JSON at the ~277 B/entry this manifest measures: big enough that per-object overhead is noise, small enough that one changed file rewrites ~1 MiB rather than the whole project.
Functions§
- assemble
- Rebuild the entry map from a chunk list and the fetched bodies.
- chunk_
address - The content address of a chunk body: SHA-256, truncated to 128 bits.
- chunk_
ranges - The shipped sizing.
- chunk_
ranges_ with - Split a SORTED key stream into content-defined runs, as end-exclusive
indices.
[]for no keys; the last run always ends atkeys.len(). - split
- split_
with - Split entries into chunk bodies and their references.