Skip to main content

Crate chassisdb

Crate chassisdb 

Source
Expand description

Chassis - an embedded vector index for local semantic search

Chassis keeps an index of vectors in one file and searches it inside your process, with no server. You store vectors under your own ids; the records they stand for stay in your application’s storage.

§Features

  • On-disk storage using memory-mapped I/O
  • One file: two checksummed header copies, then append-only regions aligned to 64 KiB
  • One writer per file; concurrent searches from its threads and from IndexReaders in other processes
  • Explicit durability control via flush()
  • Zero external dependencies (no daemons or services)

§Example

use chassisdb::{VectorIndex, IndexOptions};

// Open or create an index
let mut index = VectorIndex::open("embeddings.chassis", 768, IndexOptions::default())?;

// Insert vectors
let embedding = vec![0.1; 768];
let id = index.add(&embedding)?;

// Flush to disk for durability
index.flush()?;

// Search for nearest neighbors
let query = vec![0.1; 768];
let results = index.search(&query, 10)?;

§Design Philosophy

Chassis is intentionally simple and focused. It does not aim to be:

  • A database server
  • A cloud service
  • A distributed system
  • A query engine

These concerns are left to the application. Chassis is embedded the way SQLite is: a library in your process, with everything in one file.

§Internals

The internals feature makes the layers under the index public, for this crate’s own tests and benchmarks. They carry no semver promise: any release may change or remove them.

Re-exports§

pub use distance::DistanceMetric;
pub use distance::cosine_distance;
pub use distance::euclidean_distance;

Modules§

distance
SIMD-accelerated distance metrics for vector comparison.

Structs§

Check
Ids of the vectors a search of graph can return, in slot order. What check found: in an index in good order, both lists are empty.
Error
An error from VectorIndex or IndexReader. It converts into anyhow::Error and any Box<dyn Error>, so ? works where those are returned.
IndexOptions
Configuration options for VectorIndex
IndexReader
Searches an index while a VectorIndex in another process may be writing it (ADR-0008, decision 5). Any number of readers can open the same file; they take no lock.
SearchResult
A search result: a vector’s id and its distance from the query. Results compare by distance, then id, and are equal only when both are.
VectorIndex
Public facade for Chassis vector index

Enums§

ErrorKind
What went wrong, for a program to act on. Bindings map it: C’s chassis_last_error_code, Python’s exception classes.
Precision
What an index keeps of each component of a vector; fixed when the index is created.

Type Aliases§

Result
Result with Chassis’s Error.