#[non_exhaustive]pub struct UsearchStore { /* private fields */ }Expand description
Manages multiple VectorIndex instances — one per scope (global, each
project) plus a combined “all” index. Every memory exists in exactly two
indexes: its scope-specific index + the “all” index.
UsearchStore is Send + Sync because all inner state is protected by
RwLock / Mutex.
Implementations§
Source§impl UsearchStore
impl UsearchStore
Sourcepub fn new(dimensions: usize) -> Result<Self, MemoryError>
pub fn new(dimensions: usize) -> Result<Self, MemoryError>
Create a new UsearchStore with empty global + all indexes.
Trait Implementations§
Source§impl VectorStore for UsearchStore
impl VectorStore for UsearchStore
Source§fn add(
&self,
scope: &Scope,
vector: &[f32],
qualified_name: String,
) -> Result<u64, MemoryError>
fn add( &self, scope: &Scope, vector: &[f32], qualified_name: String, ) -> Result<u64, MemoryError>
Source§fn remove(&self, scope: &Scope, qualified_name: &str) -> Result<(), MemoryError>
fn remove(&self, scope: &Scope, qualified_name: &str) -> Result<(), MemoryError>
Remove the entry for
qualified_name from scope (and from the
all-index). Best-effort — does not fail if the entry is absent.Source§fn search(
&self,
filter: &ScopeFilter,
query: &[f32],
limit: usize,
) -> Result<Vec<(u64, String, f32)>, MemoryError>
fn search( &self, filter: &ScopeFilter, query: &[f32], limit: usize, ) -> Result<Vec<(u64, String, f32)>, MemoryError>
Source§fn find_by_name(&self, qualified_name: &str) -> Option<u64>
fn find_by_name(&self, qualified_name: &str) -> Option<u64>
Look up the vector key for a qualified name in the all-index. Read more
Source§fn save(&self, dir: &Path) -> Result<(), MemoryError>
fn save(&self, dir: &Path) -> Result<(), MemoryError>
Persist all indexes to subdirectories under
dir.Source§fn dimensions(&self) -> usize
fn dimensions(&self) -> usize
The embedding dimensionality this store was initialised with.
Source§fn commit_sha(&self) -> Option<String>
fn commit_sha(&self) -> Option<String>
The commit SHA last written to or read from the index metadata, if any.
Source§fn set_commit_sha(&self, sha: Option<&str>)
fn set_commit_sha(&self, sha: Option<&str>)
Overwrite the stored commit SHA.
Auto Trait Implementations§
impl !Freeze for UsearchStore
impl RefUnwindSafe for UsearchStore
impl Send for UsearchStore
impl Sync for UsearchStore
impl Unpin for UsearchStore
impl UnsafeUnpin for UsearchStore
impl UnwindSafe for UsearchStore
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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 more