pub trait VectorStorage: Send + Sync {
type Config: Send + Sync;
// Required methods
fn create_index<'life0, 'async_trait>(
&'life0 self,
config: IndexConfig,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn list_indexes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn describe_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<IndexInfo, VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn delete_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn upsert_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
documents: Vec<Document>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn search<'life0, 'async_trait>(
&'life0 self,
request: SearchRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn update_document<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn delete_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<String>,
include_vectors: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>
where 'life0: 'async_trait,
Self: 'async_trait;
fn backend_info(&self) -> BackendInfo;
}
Expand description
Core trait for vector storage backends
This trait defines the interface that all vector storage implementations must provide. It’s designed to be storage-agnostic and support various backends like in-memory, SQLite, Qdrant, MongoDB, etc.
Required Associated Types§
Required Methods§
Sourcefn create_index<'life0, 'async_trait>(
&'life0 self,
config: IndexConfig,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn create_index<'life0, 'async_trait>(
&'life0 self,
config: IndexConfig,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Create a new vector index
Sourcefn list_indexes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn list_indexes<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
List all available indexes
Sourcefn describe_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<IndexInfo, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn describe_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<IndexInfo, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Get information about a specific index
Sourcefn delete_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete_index<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Delete an index and all its vectors
Sourcefn upsert_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
documents: Vec<Document>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn upsert_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
documents: Vec<Document>,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Insert or update documents in the index
Sourcefn search<'life0, 'async_trait>(
&'life0 self,
request: SearchRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
request: SearchRequest,
) -> Pin<Box<dyn Future<Output = Result<SearchResponse, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Search for similar vectors
Sourcefn update_document<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn update_document<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
document: Document,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Update a specific document
Sourcefn delete_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn delete_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<String>,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Delete documents by IDs
Sourcefn get_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<String>,
include_vectors: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_documents<'life0, 'life1, 'async_trait>(
&'life0 self,
index_name: &'life1 str,
ids: Vec<String>,
include_vectors: bool,
) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Get documents by IDs
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), VectorError>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: 'async_trait,
Check if the storage backend is healthy
Sourcefn backend_info(&self) -> BackendInfo
fn backend_info(&self) -> BackendInfo
Get storage backend information