Skip to main content

Module reach

Module reach 

Source
Expand description

__gunnar_reach__ — reachability bitmaps.

For each selected commit, the set of objects reachable from it — the commit itself, its ancestors, and every tree and blob those commits point at — recorded as a roaring bitmap over object ordinals.

The ordinal space is the archive’s oid-lexicographic ordering of its distinct objects, which is also the order the sorted lookup sub-index is in and the order __gunnar_oid__ records in its ordinal column. So a bitmap position is resolvable to an object with the oid index alone.

What it buys: want − have becomes reach(want) ANDNOT reach(have) — a bitmap operation instead of a graph traversal. No speedup is claimed here. Nothing in this repository has measured it against a real repository with real merge history; the structure is built and correct, the number is not earned (LAW 7).

Cost, stated plainly: the builder is O(commits × bitmap width) in time and holds live bitmaps for commits whose children are not yet processed, plus one memoized tree-closure bitmap per distinct tree. On a wide DAG that is not cheap. ReachPolicy::max_commits bounds how many bitmaps are kept, not how many are computed.

Structs§

ObjectFacts
What the builder needs to know about every object in the archive.
OrdinalSpace
oid → ordinal, and ordinal → oid, over one flat buffer and nothing else.
ReachEntry
One sealed bitmap.
ReachPolicy
Which commits get a bitmap.

Traits§

TreeSource
Where a tree’s bytes come from — a lookup, not a table.

Functions§

build_reach
Build the reachability bitmaps.
build_reach_batch
carry_reach
Carry a reachability table across a fold — the same bitmaps, renumbered into the new ordinal space, for the commits the new graph still holds.
decode_reach
needs_payload
Which objects a repack must hold to make the reachability pass exact.
reach_schema
read_reach
Read the reachability bitmaps out of a sealed archive. Ok(None) when absent.