pub struct Engine { /* private fields */ }Expand description
Per-table engine handle.
One engine wraps one VectorStore table. The store is
held behind an Arc so multiple handles can share the
same underlying state (the registry never duplicates a
store; it just hands out further Engine clones).
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn in_memory(schema: TableSchema) -> Result<Self, StoreError>
pub fn in_memory(schema: TableSchema) -> Result<Self, StoreError>
Build a fresh in-memory engine for schema.
The schema’s name becomes the engine’s table name. The
returned engine is the only handle on the new store; if
the registry wants a second handle it should
Engine::clone this one.
§Errors
Surfaces any StoreError from
VectorStore::create_table.
Sourcepub fn with_store(store: Arc<VectorStore>, table: String) -> Self
pub fn with_store(store: Arc<VectorStore>, table: String) -> Self
Wrap an existing VectorStore that already holds the
table. Used by embedders that want to share a store
across many engines.
Sourcepub fn table_name(&self) -> &str
pub fn table_name(&self) -> &str
Bound table name.
Sourcepub fn store(&self) -> &Arc<VectorStore>
pub fn store(&self) -> &Arc<VectorStore>
Borrow the underlying VectorStore.
Sourcepub fn upsert(
&self,
key: RowKey,
vector: &[f32],
metadata: HashMap<String, Value>,
) -> Result<(), StoreError>
pub fn upsert( &self, key: RowKey, vector: &[f32], metadata: HashMap<String, Value>, ) -> Result<(), StoreError>
Sourcepub fn search(
&self,
query: &[f32],
k: usize,
ef: Option<usize>,
) -> Result<Vec<(VectorRow, f32)>, StoreError>
pub fn search( &self, query: &[f32], k: usize, ef: Option<usize>, ) -> Result<Vec<(VectorRow, f32)>, StoreError>
Sourcepub fn stats(&self) -> Result<TableStats, StoreError>
pub fn stats(&self) -> Result<TableStats, StoreError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Engine
impl !RefUnwindSafe for Engine
impl Send for Engine
impl Sync for Engine
impl Unpin for Engine
impl UnsafeUnpin for Engine
impl !UnwindSafe for Engine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
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
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
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.