Expand description
Index objects (Phase 2 secondary indexes).
An IndexSet lives alongside a Commit and
carries pointers to helper Prolly trees that make common agent
queries fast:
nodes_by_label- for each node label, a Prolly tree keyed byNodeId(16 bytes) whose values are node CIDs. Turns “all Person nodes” from O(n) into a label-scoped cursor iteration.nodes_by_prop- for each (label,prop_name), a Prolly tree keyed byblake3(canonical_ipld(value))[..16]whose values are node CIDs. Turns “node where name=‘Alice’” into O(log n) point lookup. Single-valued: duplicate (label, prop, value) tuples collide at the key level; last-write-wins (use theresolve_or_create_nodehelper on Transaction to avoid creating duplicates).outgoing- Prolly tree keyed by sourceNodeIdwhose values are CIDs ofAdjacencyBucketobjects - a small sorted list of(edge_label, edge_cid)pairs for that node. Turns “outgoing edges of X” into O(log n) + one bucket read. Previously namedadjacency; the on-wire field aliasadjacencyis still accepted on decode for repos written before the incoming-index addition.incoming- Prolly tree keyed by destinationNodeIdwhose values are CIDs ofIncomingAdjacencyBucketobjects - a small sorted list of(etype, src, edge_cid)triples for that node. Turns “who points at X” into O(log n) + one bucket read. Added alongside the incoming-index feature; mandatesIndexSetrebuild on format-bump commits.
All indexes are derived from the node + edge Prolly trees owned by
the Commit. They are entirely optional; a commit with
indexes = None still functions (queries fall back to full scan).
Structs§
- Adjacency
Bucket - Per-source-node bucket of outgoing edges. Stored as a standalone object so the adjacency Prolly tree can cheaply reference a list without inlining it into every leaf.
- Adjacency
Entry - One outgoing-edge record inside an
AdjacencyBucket. - Incoming
Adjacency Bucket - Per-destination-node bucket of incoming edges. Stored as a standalone object so the incoming-adjacency Prolly tree can cheaply reference a list without inlining it into every leaf.
- Incoming
Adjacency Entry - One incoming-edge record inside an
IncomingAdjacencyBucket. - Index
Set - Top-level secondary-index aggregator (SPEC §4.8, added in mnem/0.2,
extended with
incomingin mnem/0.3).