Skip to main content

ChunkedDocumentStoreTrait

Trait ChunkedDocumentStoreTrait 

Source
pub trait ChunkedDocumentStoreTrait: Send + Sync {
Show 16 methods // Required methods fn add_parent_document<'life0, 'async_trait>( &'life0 self, document: Document, chunk_size: usize, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<String>), VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn add_parent_documents<'life0, 'async_trait>( &'life0 self, documents: Vec<Document>, chunk_size: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Vec<String>)>, VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_parent_document<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Document>, VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_chunk<'life0, 'life1, 'async_trait>( &'life0 self, chunk_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ChunkDocument>, VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_chunk_document<'life0, 'life1, 'async_trait>( &'life0 self, chunk_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Document>, VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_chunks_for_parent<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkDocument>, VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn get_chunk_documents_for_parent<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn delete_parent_document<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait; fn parent_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn chunk_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn get_all_chunks<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkDocument>, VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>> where 'life0: 'async_trait, Self: 'async_trait; fn add_parent_document_blocking( &self, document: Document, chunk_size: usize, ) -> Result<(String, Vec<String>), VectorStoreError>; fn get_parent_document_blocking( &self, parent_id: &str, ) -> Result<Option<Document>, VectorStoreError>; fn get_chunk_blocking( &self, chunk_id: &str, ) -> Result<Option<ChunkDocument>, VectorStoreError>; fn blocking_get_chunks_for_parent( &self, parent_id: &str, ) -> Result<Vec<ChunkDocument>, VectorStoreError>;
}
Expand description

Document store trait supporting a parent-child structure

This trait defines a unified interface for the back-reference store, supporting:

  • MongoDB (production)
  • InMemory (development/test)
  • Redis (cache layer, reserved)
  • SQLite (local storage, reserved)

Required Methods§

Source

fn add_parent_document<'life0, 'async_trait>( &'life0 self, document: Document, chunk_size: usize, ) -> Pin<Box<dyn Future<Output = Result<(String, Vec<String>), VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Adds a Parent document and automatically splits it into chunks

§Arguments
  • document: the original document
  • chunk_size: the character size of each chunk
§Returns
  • (parent_id, chunk_ids): the Parent ID and the generated Chunk ID list
Source

fn add_parent_documents<'life0, 'async_trait>( &'life0 self, documents: Vec<Document>, chunk_size: usize, ) -> Pin<Box<dyn Future<Output = Result<Vec<(String, Vec<String>)>, VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Adds Parent documents in bulk

Source

fn get_parent_document<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Document>, VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Gets a Parent document

Source

fn get_chunk<'life0, 'life1, 'async_trait>( &'life0 self, chunk_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<ChunkDocument>, VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Gets a single Chunk

Source

fn get_chunk_document<'life0, 'life1, 'async_trait>( &'life0 self, chunk_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Option<Document>, VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Gets a single Chunk (as a Document)

Source

fn get_chunks_for_parent<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkDocument>, VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Gets all Chunks of a Parent

Source

fn get_chunk_documents_for_parent<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<Vec<Document>, VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Gets all Chunks of a Parent (as Documents)

Source

fn delete_parent_document<'life0, 'life1, 'async_trait>( &'life0 self, parent_id: &'life1 str, ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Deletes a Parent document and all of its Chunks

Source

fn parent_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Gets the Parent document count

Source

fn chunk_count<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = usize> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Gets the Chunk document count

Source

fn get_all_chunks<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkDocument>, VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Gets all Chunks

Source

fn clear<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<(), VectorStoreError>> + Send + 'async_trait>>
where 'life0: 'async_trait, Self: 'async_trait,

Clears all data

Source

fn add_parent_document_blocking( &self, document: Document, chunk_size: usize, ) -> Result<(String, Vec<String>), VectorStoreError>

Adds a Parent document (blocking version)

Source

fn get_parent_document_blocking( &self, parent_id: &str, ) -> Result<Option<Document>, VectorStoreError>

Gets a Parent document (blocking version)

Source

fn get_chunk_blocking( &self, chunk_id: &str, ) -> Result<Option<ChunkDocument>, VectorStoreError>

Gets a single Chunk (blocking version)

Source

fn blocking_get_chunks_for_parent( &self, parent_id: &str, ) -> Result<Vec<ChunkDocument>, VectorStoreError>

Gets all Chunks of a Parent (blocking version)

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§