Skip to main content

Module concurrent

Module concurrent 

Source
Expand description

Concurrent access wrapper over HnswIndex.

Wraps the index in Arc<RwLock<_>> (using parking_lot for performance) to support the architecture’s “high-velocity concurrent reads + append-writes” pattern. Cloning a ConcurrentHnsw is cheap — both clones share the same underlying index.

§Write contention

parking_lot::RwLock is writer-preferring, so a long-running search cannot starve an insert. For workloads with very high write frequency, consider batching inserts under a single write lock.

§Sharded variant

For workloads that genuinely need parallel inserts, a sharded index (multiple sub-indices keyed by hash(id)) is on the roadmap. The single-lock version covers the OmniPulse usage pattern (1 inserter, many searchers) cleanly.

Structs§

ConcurrentHnsw
Thread-safe handle to a shared HNSW index.