pub trait VectorStore: Send + Sync {
// Required methods
fn upsert<'life0, 'async_trait>(
&'life0 self,
documents: Vec<EmbeddedDocument>,
) -> Pin<Box<dyn Future<Output = Result<UpsertStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn search<'life0, 'async_trait>(
&'life0 self,
query_embedding: Vec<f32>,
filter: Option<Filter>,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn delete<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<DeleteStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddedDocument>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn count<'life0, 'async_trait>(
&'life0 self,
filter: Option<Filter>,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn backend_name(&self) -> &'static str;
// Provided method
fn dimensions(&self) -> Option<usize> { ... }
}Expand description
Trait for vector storage backends
Implementors provide vector similarity search with metadata filtering. All operations are async to support both local and remote backends.
Required Methods§
Sourcefn upsert<'life0, 'async_trait>(
&'life0 self,
documents: Vec<EmbeddedDocument>,
) -> Pin<Box<dyn Future<Output = Result<UpsertStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn upsert<'life0, 'async_trait>(
&'life0 self,
documents: Vec<EmbeddedDocument>,
) -> Pin<Box<dyn Future<Output = Result<UpsertStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Insert or update documents in the store
Documents with existing IDs will be updated, new IDs will be inserted.
Sourcefn search<'life0, 'async_trait>(
&'life0 self,
query_embedding: Vec<f32>,
filter: Option<Filter>,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
query_embedding: Vec<f32>,
filter: Option<Filter>,
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Sourcefn delete<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<DeleteStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn delete<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<DeleteStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Delete documents by ID
Sourcefn get<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddedDocument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get<'life0, 'async_trait>(
&'life0 self,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<Vec<EmbeddedDocument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get documents by ID
Sourcefn count<'life0, 'async_trait>(
&'life0 self,
filter: Option<Filter>,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn count<'life0, 'async_trait>(
&'life0 self,
filter: Option<Filter>,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Count documents, optionally filtered
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<HealthStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check backend health/connectivity
Sourcefn backend_name(&self) -> &'static str
fn backend_name(&self) -> &'static str
Get the name of this backend (for logging/debugging)
Provided Methods§
Sourcefn dimensions(&self) -> Option<usize>
fn dimensions(&self) -> Option<usize>
Get configured vector dimensions (if known)