spacedb_vector/lib.rs
1#![forbid(unsafe_code)]
2//! # spacedb-vector — SpaceDB Layer 4 (the private-RAG substrate)
3//!
4//! A native, on-node vector index co-located with the data: a query embedding
5//! goes in, and **only the top-k results come out** — the corpus never leaves the
6//! home. An authorized AI agent's retrieval runs here, **gated by an mID
7//! capability** ([`retrieve`]), which is the concrete mechanism behind
8//! "inaccessible by default, accessible by mID-gated consent": semantic access to
9//! *results*, not bulk data.
10//!
11//! Open-core (MIT): depends only on `spacedb-access` (for the capability gate).
12//! S3 ships an exact flat k-NN [`VectorIndex`]; sub-linear ANN (HNSW / IVF) is a
13//! future optimization behind the same surface.
14
15mod error;
16pub use error::{VectorError, VectorResult};
17
18mod index;
19pub use index::{Match, Metric, VectorIndex};
20
21mod retrieve;
22pub use retrieve::retrieve;
23
24/// Compiles the README's examples as doctests, so the documented API can never
25/// drift from the real one. Not part of the public API, and not rendered into
26/// the crate docs — it exists only under `cargo test --doc`.
27#[cfg(doctest)]
28#[doc = include_str!("../README.md")]
29pub struct ReadmeDoctests;