Expand description
Tenant-partitioned CSR index.
The graph engine multiplexes many tenants onto one per-core CsrIndex.
Historically that multiplexing was done by prepending "{tid}:" to every
node key before handing it to the CSR — a lexical scheme that required
every API boundary (results, traversal output, algorithm emit) to strip
the prefix on the way back out. The heuristic strippers were fragile
(mangled any id that happened to match the shape) and the strip was
opt-in (forgetting it leaked internal keys to clients).
ShardedCsrIndex replaces that scheme with structural partitioning:
one independent CsrIndex per tenant, keyed in a HashMap<TenantId, _>.
Node keys inside a partition are the raw user-visible names — no prefix,
no strip, no heuristic. Cross-tenant access is not a question of auth
checks; it is structurally impossible because partitions don’t share
key space.
§Invariants
- One tenant per partition. Every
CsrIndexheld inpartitionscontains only one tenant’s nodes and edges. Mixing is a programming bug, not a runtime condition. - No key prefixing. Callers pass user-visible names directly; the partition never sees a scoped form.
- Partition lifecycle is explicit.
get_or_createconstructs on first use;drop_partitionremoves atomically. No auto-eviction at this layer (belongs to a future pool-management concern). - Data Plane shape preserved. This type is
!Sendin the same wayCsrIndexis (viaCell<u32>access counters). It is owned by a single Data Plane core.
Structs§
- Sharded
CsrIndex - Per-tenant partitioned CSR index.