pub struct RuVectorStore { /* private fields */ }Expand description
RuVector store — manages multiple per-table VectorDB instances.
Implementations§
Source§impl RuVectorStore
impl RuVectorStore
Sourcepub async fn open(path: &Path, dimensions: usize) -> Result<Self, RuVectorError>
pub async fn open(path: &Path, dimensions: usize) -> Result<Self, RuVectorError>
Open (or create) a RuVector store at the given directory.
dimensions must equal the output dimension of the embedding model in use.
Passing the wrong dimension will cause Dimension mismatch errors on insert.
Use VECTOR_DIM as the default (384) when the embedding provider is not
yet known, and prefer probing the actual embedder output at startup.
Sourcepub async fn ensure_tables(&self) -> Result<(), RuVectorError>
pub async fn ensure_tables(&self) -> Result<(), RuVectorError>
Ensure the standard vector tables exist (idempotent).
Retries up to 5 times with exponential backoff (200ms → 3.2s) to handle
transient file-lock contention from other brain processes (e.g. a
standalone brain mcp holding the redb lock when the daemon starts).
Sourcepub async fn add_vectors(
&self,
table_name: &str,
ids: Vec<String>,
_contents: Vec<String>,
vectors: Vec<Vec<f32>>,
_timestamps: Vec<String>,
_source_type: &str,
) -> Result<(), RuVectorError>
pub async fn add_vectors( &self, table_name: &str, ids: Vec<String>, _contents: Vec<String>, vectors: Vec<Vec<f32>>, _timestamps: Vec<String>, _source_type: &str, ) -> Result<(), RuVectorError>
Add vectors to a table. ids and vectors must have the same length.
Sourcepub async fn search(
&self,
table_name: &str,
query_vector: Vec<f32>,
top_k: usize,
) -> Result<Vec<VectorResult>, RuVectorError>
pub async fn search( &self, table_name: &str, query_vector: Vec<f32>, top_k: usize, ) -> Result<Vec<VectorResult>, RuVectorError>
Search for the most similar vectors using cosine distance.
Returns results sorted by distance ascending (closest first).
Sourcepub async fn delete(
&self,
table_name: &str,
id: &str,
) -> Result<(), RuVectorError>
pub async fn delete( &self, table_name: &str, id: &str, ) -> Result<(), RuVectorError>
Delete a vector by ID from a table.
Sourcepub async fn table_count(
&self,
table_name: &str,
) -> Result<usize, RuVectorError>
pub async fn table_count( &self, table_name: &str, ) -> Result<usize, RuVectorError>
Get the row count for a table.
Sourcepub async fn table_names(&self) -> Result<Vec<String>, RuVectorError>
pub async fn table_names(&self) -> Result<Vec<String>, RuVectorError>
List all open table names.
Trait Implementations§
Source§impl Clone for RuVectorStore
impl Clone for RuVectorStore
Source§fn clone(&self) -> RuVectorStore
fn clone(&self) -> RuVectorStore
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for RuVectorStore
impl RefUnwindSafe for RuVectorStore
impl Send for RuVectorStore
impl Sync for RuVectorStore
impl Unpin for RuVectorStore
impl UnsafeUnpin for RuVectorStore
impl UnwindSafe for RuVectorStore
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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