pub struct HashSetData {
pub keys: Arc<Vec<Arc<String>>>,
pub index: HashMap<u64, Vec<u32>>,
}Expand description
HashSet storage — one keyspace, no values. Mirror of HashMapData
with the values buffer dropped.
ADR-006 §2.7.15 / Q16 amendment (mirror of §2.7.9 FilterExpr / §2.7.13
Reference precedent for the cardinality-amendment shape, but Set is
a HashMap sibling — full HeapValue::HashSet arm rather than
pure-discriminator). Reuses the Stage C P1(b) Phase 2d Array shape
(TypedBuffer<Arc<String>>) for the keys buffer verbatim. Insertion
order is the canonical storage; the index is a sidecar acceleration
structure for O(1) set.has(key).
String-only keyspace at landing (per the W9-set-methods owner
audit’s Path A scope and the §2.7.15 Q16 ruling). Heterogeneous-
element keysets (int-keyed, TypedObject-keyed) are explicitly
out-of-scope; the Path B (TypedSet<T> per element kind) rebuild
is a future Phase-2c amendment with measurement.
Fields§
§keys: Arc<Vec<Arc<String>>>Insertion-ordered keys (string-typed buffer).
Storage shape: Arc<Vec<Arc<String>>> post-V3-S5 ckpt-5-prime²a
(Migration shape (a) per supervisor 2026-05-15 ratification —
TypedBuffer<T> wrapper layer retired wholesale at ckpt-4;
Arc<Vec<T>> is the smallest delta preserving Arc::make_mut
clone-on-write semantics).
index: HashMap<u64, Vec<u32>>Eager bucket-index: hash → list of indices into keys array.
Enables O(1) lookup at set.has(key). Hash is FNV-1a over the
key string bytes — same as HashMapData::index.
Implementations§
Source§impl HashSetData
impl HashSetData
Sourcepub fn from_keys(keys: Vec<Arc<String>>) -> Self
pub fn from_keys(keys: Vec<Arc<String>>) -> Self
Build from a Vec<Arc<String>> of keys, computing the bucket
index eagerly. Duplicate keys in the input are collapsed
(insertion-order preserved, first occurrence wins).
Sourcepub fn contains(&self, key: &str) -> bool
pub fn contains(&self, key: &str) -> bool
Whether the set contains the given key. O(1) via the bucket index plus a short bucket scan for collision disambiguation.
Sourcepub fn insert(&mut self, key: Arc<String>) -> bool
pub fn insert(&mut self, key: Arc<String>) -> bool
Insert a key. Returns true if the key was newly added,
false if it was already present (no-op in the latter case).
Sourcepub fn remove(&mut self, key: &str) -> bool
pub fn remove(&mut self, key: &str) -> bool
Remove the entry under key. Returns true if the key was
present (and removed), false if no entry existed. The bucket
index is updated to reflect the buffer’s post-removal indices:
every entry after the removed slot shifts down by one position
(mirror of HashMapData::remove).