Expand description
§nidus
A small, pure-Rust embeddable vector store: brute-force cosine search over a single append-only directory, with typed metadata filters and many logical collections sharing one embedding space. No FFI, no C, no SQL.
See SPEC.md for the full design.
use nidus::{Nidus, Config, Record, SearchOpts, Scope};
use std::collections::BTreeMap;
let mut db = Nidus::open(Config::new("/tmp/store", 3))?;
db.create_collection("docs")?;
db.upsert("docs", &[Record { id: "a".into(), vector: vec![1.0, 0.0, 0.0], attrs: BTreeMap::new() }])?;
let hits = db.search("docs", &[1.0, 0.0, 0.0], &SearchOpts { top_k: 5, ..Default::default() })?;Structs§
- Config
- Everything needed to open a store. Construct with
Config::newand adjust via the builder setters. - Filter
- A conjunction (AND) of predicates. An empty filter matches everything.
- Footprint
- A cheap, allocation-free snapshot of a store’s RAM/disk footprint — the
introspection hook a host uses to decide whether it can afford more data before
hitting a memory ceiling.
vector_bytesis the dominant, predictable cost; the in-RAM index (ids + attrs) is extra on top and not counted here. - Hit
- One search result. Carries its source
collection(ids are unique only within a collection) and the matched record’sattrs, but deliberately not its vector. - Nidus
- An open vector store. Synchronous; wrap in
Arc<RwLock<Nidus>>for concurrent searchers + one writer (SPEC.md §6.5). - Record
- A document: a caller-supplied id, its embedding, and typed metadata.
- Search
Opts - Query parameters for a search.
Enums§
- Fsync
- How aggressively writes are flushed to disk.
- Open
Mode - Whether the store may be written.
- Predicate
- A single attribute predicate. Predicates are AND-combined inside a
Filter. - Scope
- Which collections a
Nidus::searchranks over (SPEC.md §7). Scores are comparable across collections because the whole store shares one embedding space. Acceptsimpl Into<Scope>, so&strand&[&str]work directly. - Value
- A typed metadata value attached to a
Record.
Type Aliases§
- Result
Result<T, Error>