#[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.
reporter is called with report_ok/report_err after each add and
search so /readyz reflects the store’s operational state passively.
Sourcepub fn new_with_reporter(
dimensions: usize,
reporter: SubsystemReporter,
) -> Result<Self, MemoryError>
pub fn new_with_reporter( dimensions: usize, reporter: SubsystemReporter, ) -> Result<Self, MemoryError>
Create a new UsearchStore with a specific health reporter.
Sourcepub fn load(dir: &Path, dimensions: usize) -> Result<Self, MemoryError>
pub fn load(dir: &Path, dimensions: usize) -> Result<Self, MemoryError>
Load all indexes from subdirectories under dir.
Missing subdirectories are treated as empty — those scopes will be rebuilt incrementally on next use.
Sourcepub fn load_with_reporter(
dir: &Path,
dimensions: usize,
reporter: SubsystemReporter,
) -> Result<Self, MemoryError>
pub fn load_with_reporter( dir: &Path, dimensions: usize, reporter: SubsystemReporter, ) -> Result<Self, MemoryError>
Load all indexes from subdirectories under dir with a specific health reporter.
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>
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>
Source§fn save(&self, dir: &Path) -> Result<(), MemoryError>
fn save(&self, dir: &Path) -> Result<(), MemoryError>
dir.Source§fn dimensions(&self) -> usize
fn dimensions(&self) -> usize
Source§fn commit_sha(&self) -> Option<String>
fn commit_sha(&self) -> Option<String>
Source§fn set_commit_sha(&self, sha: Option<&str>)
fn set_commit_sha(&self, sha: Option<&str>)
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
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>
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>
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