ruvector_lsm_ann - Rust
Skip to main content

Crate ruvector_lsm_ann

Crate ruvector_lsm_ann 

Source
Expand description

LSM-ANN: write-optimized streaming vector index for agent memory.

Organises vectors in a Log-Structured Merge (LSM) tier hierarchy:

┌───────────────────────────────────────┐
│ L0  MemTable  (mutable, brute-force)  │  ← all writes land here first
├───────────────────────────────────────┤
│ L1  Small frozen segments (NSW graph) │  ← compacted from L0
├───────────────────────────────────────┤
│ L2  Large merged segment  (NSW graph) │  ← compacted from L1 segments
└───────────────────────────────────────┘

Queries merge candidate lists from all tiers and re-rank by exact distance.

Re-exports§

pub use lsm::BaselineLsm;
pub use lsm::FullLsm;
pub use lsm::TwoTierLsm;
pub use memtable::MemTable;
pub use segment::FrozenSegment;

Modules§

lsm
Three LSM-ANN index variants with increasing sophistication.
memtable
MemTable: the mutable L0 write buffer.
segment
FrozenSegment: an immutable Navigable Small World (NSW) graph built over a batch of vectors. Used for L1 and L2 tiers of the LSM-ANN index.

Structs§

LsmConfig
Configuration shared across variants.

Traits§

LsmIndex
Core trait for all LSM-ANN index variants.

Functions§

brute_force_knn
Brute-force k-nearest on a slice of (id, vector) pairs.
merge_candidates
Merge two candidate lists and keep the top-k by distance.
recall_at_k
Compute recall@k between result ids and ground-truth ids.
sq_dist
Euclidean squared distance (no sqrt — sufficient for ranking).