Skip to main content

VectorStore

Struct VectorStore 

Source
pub struct VectorStore { /* private fields */ }
Expand description

Per-table store front.

Implementations§

Source§

impl VectorStore

Source

pub fn open(backend: Arc<dyn Backend>) -> Result<Self, StoreError>

Build a new store on top of backend and rehydrate every schema / row that the backend already persists. The rehydration walks every row in every table and rebuilds the HNSW indexes from scratch; for the MVP this is preferable to persisting the HNSW topology because the table sizes we care about (up to ~10 million vectors) rebuild in seconds.

§Errors

Surfaces any backend error encountered during the rehydration walk.

Source

pub fn in_memory() -> Self

Build a fresh in-memory store. Convenience for tests and embedders that do not need persistence.

Source

pub fn create_table(&self, schema: TableSchema) -> Result<(), StoreError>

Register a new TableSchema.

§Errors

StoreError::TableExists when the schema’s name is already in use.

Source

pub fn tables(&self) -> Vec<TableSchema>

List every registered table.

Source

pub fn upsert( &self, table: &str, key: RowKey, vector: &[f32], metadata: HashMap<String, Value>, ) -> Result<(), StoreError>

Insert or overwrite a vector row.

The vector slice is encoded with the table’s codec and fed to the HNSW index in f32 form. Re-inserts (same key) replace the prior row in the row store and link a fresh HNSW node, soft-deleting the prior one.

§Errors

StoreError::UnknownTable when the table is not registered, StoreError::DimensionMismatch when the vector’s dimension does not match the table dimension, and StoreError::Encoding / StoreError::Index / StoreError::Backend for the underlying failures.

Source

pub fn get( &self, table: &str, key: &[u8], ) -> Result<Option<VectorRow>, StoreError>

Fetch the row at (table, key).

§Errors

StoreError::UnknownTable for an unregistered table; StoreError::Backend for a backend failure.

Source

pub fn delete(&self, table: &str, key: &[u8]) -> Result<bool, StoreError>

Delete the row at (table, key). Returns true when present.

§Errors

StoreError::UnknownTable for an unregistered table; StoreError::Backend for a backend failure.

Source

pub fn search( &self, table: &str, query: &[f32], k: usize, ef: Option<usize>, ) -> Result<Vec<(VectorRow, f32)>, StoreError>

Run a top-k ANN search against table with query.

ef overrides the index’s default search beam width.

§Errors

StoreError::UnknownTable for an unregistered table; StoreError::DimensionMismatch when the query dimension does not match the table dimension.

Source

pub fn stats(&self, table: &str) -> Result<TableStats, StoreError>

Per-table snapshot statistics: live row count, soft- deleted node count, dimension, codec.

§Errors

StoreError::UnknownTable for an unregistered table.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,