pub trait AsyncVectorStore: Send + Sync {
type Error: Error + Send + Sync + 'static;
// Required methods
fn add_vector<'life0, 'async_trait>(
&'life0 mut self,
id: String,
vector: Vec<f32>,
metadata: VectorMetadata,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn add_vectors_batch<'life0, 'async_trait>(
&'life0 mut self,
vectors: VectorBatch,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vector: &'life1 [f32],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn search_with_threshold<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vector: &'life1 [f32],
k: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_vector<'life0, 'life1, 'async_trait>(
&'life0 mut self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn len<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn add_vectors_batch_concurrent<'life0, 'async_trait>(
&'life0 mut self,
vectors: VectorBatch,
max_concurrent: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn search_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vectors: &'life1 [Vec<f32>],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<SearchResult>>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn remove_vectors_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
ids: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn build_index<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
}Expand description
Async vector similarity search abstraction for non-blocking vector operations
§Async Version
This trait provides async operations for vector search with better concurrency and scalability.
Required Associated Types§
Required Methods§
Sourcefn add_vector<'life0, 'async_trait>(
&'life0 mut self,
id: String,
vector: Vec<f32>,
metadata: VectorMetadata,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_vector<'life0, 'async_trait>(
&'life0 mut self,
id: String,
vector: Vec<f32>,
metadata: VectorMetadata,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add a vector with associated ID and metadata
Sourcefn add_vectors_batch<'life0, 'async_trait>(
&'life0 mut self,
vectors: VectorBatch,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_vectors_batch<'life0, 'async_trait>(
&'life0 mut self,
vectors: VectorBatch,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add multiple vectors in batch
Sourcefn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vector: &'life1 [f32],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vector: &'life1 [f32],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search for k most similar vectors
Sourcefn search_with_threshold<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vector: &'life1 [f32],
k: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_with_threshold<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vector: &'life1 [f32],
k: usize,
threshold: f32,
) -> Pin<Box<dyn Future<Output = Result<Vec<SearchResult>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search with distance threshold
Provided Methods§
Sourcefn add_vectors_batch_concurrent<'life0, 'async_trait>(
&'life0 mut self,
vectors: VectorBatch,
max_concurrent: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn add_vectors_batch_concurrent<'life0, 'async_trait>(
&'life0 mut self,
vectors: VectorBatch,
max_concurrent: usize,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Add vectors with concurrency control for large batches
Sourcefn search_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vectors: &'life1 [Vec<f32>],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<SearchResult>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_batch<'life0, 'life1, 'async_trait>(
&'life0 self,
query_vectors: &'life1 [Vec<f32>],
k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<Vec<SearchResult>>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search multiple queries concurrently
Sourcefn remove_vectors_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
ids: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn remove_vectors_batch<'life0, 'life1, 'life2, 'async_trait>(
&'life0 mut self,
ids: &'life1 [&'life2 str],
) -> Pin<Box<dyn Future<Output = Result<Vec<bool>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Remove multiple vectors in batch
Sourcefn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn is_empty<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check if empty