DocumentStorage

Trait DocumentStorage 

Source
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§

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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

Source

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)

Source

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

Source

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

Source

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

Implementors§