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.
§Two ordinal spaces, one view
A sealed archive numbers its objects in oid-lexicographic order: 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 with the oid index
alone. OrdinalSpace::new is that space.
A live store numbers its objects in an append-only space
(OrdinalTable): a sorted base laid down by the first fold, then every
object a later push brings in appended behind it in arrival order. The point
is that a push never renumbers anything — a bitmap is a fact about an
immutable commit, and under the sorted space every push shifted every ordinal
above the new oids, so every stored bitmap had to be rewritten bit by bit
(carry_reach, 512 entries × every object, after every push). Under the
stable space a push appends a few ordinals and the table is untouched. The
sorted order is restored only when the store seals or the appended part
outgrows the base, both through one remap table (OrdinalTable::remap_to).
§No hex on any hot path
Everything below the public builders is in integers: the graph is
OrdGraph (rows and ordinals), the table is ReachTable (ordinals and
bitmaps), a tree is read by its raw oid and each of its entries is resolved
with one OrdinalSpace::ordinal_of_raw — a 16-bit fanout and a short
binary search, no decode. GUN-PERF measured the hex form on git.git
(402 227 objects): the build took 85 to 150 s and ordinal_of_hex alone was
51 % of a 65 s clone (gunnar 18c10860).
§The builder is git’s, not a closure memo
build_reach_table walks the commits parents-before-children, starts each
commit’s bitmap from its parents’ and adds the trees with the skip rule
(should_include_obj: a set bit means that object AND everything under it
is already accounted for). Work is O(objects + commits), and the memory is
the frontier — the bitmaps of commits whose children are still to come — not
one closure bitmap per distinct tree. The old builder kept the latter and
paid a hex String per tree entry on top.
Structs§
- Object
Facts - What the builder needs to know about every object in the archive.
- OrdGraph
- The commit graph in integers: one row per commit, rows in the order the
CommitNodelist came in (parents before children, ascrate::graph::assign_generationsguarantees). - Ordinal
Space - oid ⇄ ordinal, as a
Copyview that owns nothing. - Ordinal
Table - The live store’s ordinal space: a sorted base, then arrivals appended.
Owned;
Self::viewis the lookup. See the module header for why it is append-only. - Reach
Entry - One sealed bitmap, in the sealed archive’s spelling (hex commit oid). The
live store keeps a
ReachTable; this is the__gunnar_reach__row. - Reach
Policy - Which commits get a bitmap.
- Reach
Table - The live reachability table: entry
iis the closure of the commit at ordinalcommits[i]. - Reach
View - The table, its row index and the graph, paired by the fold that built them so a lookup can never mix a table with another fold’s rows.
Constants§
- NONE
- “No ordinal” / “no row” in the integer tables.
Traits§
- Tree
Source - Where a tree’s bytes come from — a lookup, not a table, keyed by the raw oid.
Functions§
- accumulate
- The bounded walk: OR into
acceverything reachable from the commit atrow, stopping at every commit that already has a bitmap. - build_
reach - The sealed builder: hex nodes in, hex entries out, over a sorted space.
Decodes each node once into an
OrdGraphand runsbuild_reach_table. - build_
reach_ batch - build_
reach_ table - Build the table from scratch, parents before children, each bitmap
started from its parents’ and completed by [
fill_tree]. - carry_
reach - Carry a sealed-spelling table across a renumbering — kept for the sealed
builders and the tests that speak hex; the live store uses
ReachTable::remappedwith one remap table.keepdecides which commits survive.Nonemeans the carry cannot be exact (a set bit’s object is gone). - decode_
live_ table - The inverse of
encode_live_table, through the IPC guard: hostile bytes are anErr, never a panic or an allocation abort.space_lenbounds the ordinals: an entry naming one outside the space is refused. - decode_
reach - encode_
live_ table - The live table as Arrow IPC stream bytes:
(commit_ordinal, bitmap). - extend_
reach_ table - Extend a table after a push: entries for the new tips (and a sample of
the other new commits), each computed by the bounded walk down to the
entries that already exist. Nothing already in the table is touched or
recomputed; the cost is the pushed commits’ trees, whatever the repository’s
size.
new_rowsmust be in parents-before-children order (the caller takes them off the generation-ordered graph). - 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.