pub struct CapabilityIndexInner { /* private fields */ }Expand description
Secondary index maintained alongside the primary
(class, node) → CapabilityMembership store. Three
inverted-index dimensions — by tag, by region, by state —
matching the plan’s CapabilityIndexInner shape. Powers the
fast path for the most common query shapes (find-by-tag,
find-in-region, find-by-state) without scanning the full
store. Composite queries pick the most selective indexed
dimension and filter the others in-memory.
PERF_AUDIT §4.6 — the inner HashSet<(u64, NodeId)> candidate
sets use BuildU64TupleHasher (private to this module), a fast
multiplicative mixer for
(u64, u64) keys. Pre-fix these used the std SipHash default,
which paid ~15-25 ns of mixing per insert/contains/remove on keys
that are already xxh3-hashed identity bytes (so collision
resistance is already there at construction; SipHash’s DoS
resistance adds zero protection). The outer HashMap<String, _> /
HashMap<NodeState, _> keep the default hasher: tag / region
strings come from publishers and the SipHash protection is
legitimately relevant there.
Trait Implementations§
Source§impl Debug for CapabilityIndexInner
impl Debug for CapabilityIndexInner
Source§impl Default for CapabilityIndexInner
impl Default for CapabilityIndexInner
Source§fn default() -> CapabilityIndexInner
fn default() -> CapabilityIndexInner
Source§impl FoldIndex<CapabilityFold> for CapabilityIndexInner
impl FoldIndex<CapabilityFold> for CapabilityIndexInner
Source§fn index_payload_equivalent(
old: &CapabilityMembership,
new: &CapabilityMembership,
) -> bool
fn index_payload_equivalent( old: &CapabilityMembership, new: &CapabilityMembership, ) -> bool
PERF_AUDIT §4.5 — on_insert keys this index on
(tags, derived synthetic tags, region, state). If the two
payloads agree on every one of those, an on_remove +
on_insert against them nets to a no-op on every bucket
(derive_synthetic_index_tags is pure over the payload, so
identical inputs produce identical synthetic outputs).
The synthetic tags derive from TWO payload fields: the
software.model.* / software.tool.* bundles inside
tags (covered by the tags equality) AND the
gpu:present / gpu:vendor:<v> projection of hardware
— so hardware MUST be part of this comparison or a
refresh that changes only the GPU shape would leave
by_synthetic stale. Comparing the whole
HardwareSummary is slightly conservative (a
memory_gb/vram_gb-only delta forces a rebuild the index
doesn’t strictly need), but the steady-state refresh the
audit targets keeps hardware identical, so the win is
unaffected and the check stays future-proof against new
hardware-derived synthetic tags. Allow-lists / metadata /
price_quote / reflex_addr are NOT consulted by this index
and may differ freely.
Source§fn on_insert(&mut self, key: &(u64, NodeId), payload: &CapabilityMembership)
fn on_insert(&mut self, key: &(u64, NodeId), payload: &CapabilityMembership)
MergeAction::Insert or
MergeAction::Replace commits to the primary store.
For Replace, the previous payload was already passed
to Self::on_remove.Source§fn on_remove(&mut self, key: &(u64, NodeId), payload: &CapabilityMembership)
fn on_remove(&mut self, key: &(u64, NodeId), payload: &CapabilityMembership)
MergeAction::Replace or an
super::Fold::evict_node eviction drops the entry
from the primary store, with the payload that’s about
to be removed.Source§fn clear(&mut self)
fn clear(&mut self)
super::Fold::restore before re-populating from a
snapshot.