pub trait Store: Send + Sync {
// Required methods
fn upsert_document<'life0, 'life1, 'async_trait>(
&'life0 self,
doc: &'life1 Document,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn replace_chunks<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
doc_id: &'life1 str,
chunks: &'life2 [Chunk],
vectors: Option<&'life3 [Vec<f32>]>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn upsert_embedding<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
doc_id: &'life2 str,
vector: &'life3 [f32],
model: &'life4 str,
dims: usize,
content_hash: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait;
fn get_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentResponse>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn get_document_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentMetadata>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait;
fn keyword_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: i64,
source: Option<&'life2 str>,
since: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkCandidate>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
fn vector_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query_vec: &'life1 [f32],
limit: i64,
source: Option<&'life2 str>,
since: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkCandidate>, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait;
}Expand description
Abstract storage backend for Context Harness.
All operations are async (via async-trait) to support both native
runtimes (tokio) and future WASM environments. In-memory
implementations return immediately-ready futures.
§Operations
| Method | Purpose |
|---|---|
upsert_document | Insert or update a document |
replace_chunks | Replace all chunks for a document |
upsert_embedding | Store an embedding vector for a chunk |
get_document | Retrieve full document with chunks |
get_document_metadata | Retrieve lightweight doc metadata |
keyword_search | Full-text keyword search |
vector_search | Cosine similarity vector search |
Required Methods§
Sourcefn upsert_document<'life0, 'life1, 'async_trait>(
&'life0 self,
doc: &'life1 Document,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn upsert_document<'life0, 'life1, 'async_trait>(
&'life0 self,
doc: &'life1 Document,
) -> Pin<Box<dyn Future<Output = Result<String, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Insert or update a document.
Returns the document ID (existing or newly generated).
Sourcefn replace_chunks<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
doc_id: &'life1 str,
chunks: &'life2 [Chunk],
vectors: Option<&'life3 [Vec<f32>]>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn replace_chunks<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
doc_id: &'life1 str,
chunks: &'life2 [Chunk],
vectors: Option<&'life3 [Vec<f32>]>,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Replace all chunks for a document, optionally storing vectors.
Sourcefn upsert_embedding<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
doc_id: &'life2 str,
vector: &'life3 [f32],
model: &'life4 str,
dims: usize,
content_hash: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
fn upsert_embedding<'life0, 'life1, 'life2, 'life3, 'life4, 'life5, 'async_trait>(
&'life0 self,
chunk_id: &'life1 str,
doc_id: &'life2 str,
vector: &'life3 [f32],
model: &'life4 str,
dims: usize,
content_hash: &'life5 str,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
'life4: 'async_trait,
'life5: 'async_trait,
Self: 'async_trait,
Store or update an embedding vector for a chunk.
Sourcefn get_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentResponse>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_document<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentResponse>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve a full document with all its chunks, by ID.
Sourcefn get_document_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentMetadata>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn get_document_metadata<'life0, 'life1, 'async_trait>(
&'life0 self,
id: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<Option<DocumentMetadata>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
Retrieve lightweight metadata for a document, by ID.
Sourcefn keyword_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: i64,
source: Option<&'life2 str>,
since: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkCandidate>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn keyword_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query: &'life1 str,
limit: i64,
source: Option<&'life2 str>,
since: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkCandidate>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Perform keyword (full-text) search, returning candidate chunks.
Sourcefn vector_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query_vec: &'life1 [f32],
limit: i64,
source: Option<&'life2 str>,
since: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkCandidate>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
fn vector_search<'life0, 'life1, 'life2, 'life3, 'async_trait>(
&'life0 self,
query_vec: &'life1 [f32],
limit: i64,
source: Option<&'life2 str>,
since: Option<&'life3 str>,
) -> Pin<Box<dyn Future<Output = Result<Vec<ChunkCandidate>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
'life3: 'async_trait,
Self: 'async_trait,
Perform vector similarity search, returning candidate chunks.