pub trait DocumentStorage: Send + Sync {
Show 15 methods
// Required methods
fn store_chunks<'life0, 'async_trait>(
&'life0 self,
chunks: Vec<DocumentChunk>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn search_similar<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn search_with_params<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
params: SearchParams,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentChunk>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_chunks_by_document<'life0, 'life1, 'async_trait>(
&'life0 self,
document_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_document<'life0, 'life1, 'async_trait>(
&'life0 self,
document_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageStats>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn list_documents<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn get_total_chunks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn optimize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn create_backup<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn restore_backup<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageHealth>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Storage backend trait for documents and vectors
Required Methods§
Sourcefn store_chunks<'life0, 'async_trait>(
&'life0 self,
chunks: Vec<DocumentChunk>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn store_chunks<'life0, 'async_trait>(
&'life0 self,
chunks: Vec<DocumentChunk>,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Store document chunks
Sourcefn search_similar<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_similar<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
top_k: usize,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search for similar chunks
Sourcefn search_with_params<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
params: SearchParams,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn search_with_params<'life0, 'life1, 'async_trait>(
&'life0 self,
query_embedding: &'life1 [f32],
params: SearchParams,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Search with custom parameters
Sourcefn get_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get chunk by ID
Sourcefn delete_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_chunk<'life0, 'life1, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<bool>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete chunk by ID
Sourcefn get_chunks_by_document<'life0, 'life1, 'async_trait>(
&'life0 self,
document_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_chunks_by_document<'life0, 'life1, 'async_trait>(
&'life0 self,
document_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Vec<DocumentChunk>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get chunks by document ID
Sourcefn delete_document<'life0, 'life1, 'async_trait>(
&'life0 self,
document_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn delete_document<'life0, 'life1, 'async_trait>(
&'life0 self,
document_id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Delete all chunks for a document
Sourcefn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_stats<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageStats>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get storage statistics
Sourcefn list_documents<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn list_documents<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<Vec<String>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
List all document IDs
Sourcefn get_total_chunks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn get_total_chunks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<usize>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Get total number of chunks
Sourcefn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Clear all data
Sourcefn optimize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn optimize<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Optimize storage (rebuild indexes, compact data)
Sourcefn create_backup<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn create_backup<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Create backup
Sourcefn restore_backup<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn restore_backup<'life0, 'life1, 'async_trait>(
&'life0 self,
path: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Restore from backup
Sourcefn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageHealth>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn health_check<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<StorageHealth>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Check storage health