Skip to main content

VectorStore

Trait VectorStore 

Source
pub trait VectorStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn insert<'life0, 'life1, 'async_trait>(
        &'life0 self,
        subject_id: Uuid,
        kind: SubstrateKind,
        namespace: &'life1 str,
        embedding: Vec<f32>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn insert_batch<'life0, 'async_trait>(
        &'life0 self,
        records: Vec<VectorRecord>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<BatchWriteSummary>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn delete<'life0, 'async_trait>(
        &'life0 self,
        subject_id: Uuid,
    ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn count<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn search<'life0, 'async_trait>(
        &'life0 self,
        request: VectorSearchRequest,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<VectorSearchHit>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn info<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = StorageResult<VectorStoreInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn rebuild<'life0, 'async_trait>(
        &'life0 self,
        scope: IndexRebuildScope,
    ) -> Pin<Box<dyn Future<Output = StorageResult<VectorStoreInfo>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided methods
    fn capabilities(&self) -> &'static VectorStoreCapabilities { ... }
    fn search_with_filter<'life0, 'async_trait>(
        &'life0 self,
        request: VectorSearchRequest,
        filter: VectorMetadataFilter,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<VectorSearchHit>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn search_batch<'life0, 'async_trait>(
        &'life0 self,
        requests: Vec<VectorSearchRequest>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<Vec<VectorSearchHit>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn update<'life0, 'life1, 'async_trait>(
        &'life0 self,
        subject_id: Uuid,
        kind: SubstrateKind,
        namespace: &'life1 str,
        embedding: Vec<f32>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn insert<'life0, 'life1, 'async_trait>( &'life0 self, subject_id: Uuid, kind: SubstrateKind, namespace: &'life1 str, embedding: Vec<f32>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Source

fn insert_batch<'life0, 'async_trait>( &'life0 self, records: Vec<VectorRecord>, ) -> Pin<Box<dyn Future<Output = StorageResult<BatchWriteSummary>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

fn delete<'life0, 'async_trait>( &'life0 self, subject_id: Uuid, ) -> Pin<Box<dyn Future<Output = StorageResult<bool>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

fn search<'life0, 'async_trait>( &'life0 self, request: VectorSearchRequest, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<VectorSearchHit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source

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

Source

fn rebuild<'life0, 'async_trait>( &'life0 self, scope: IndexRebuildScope, ) -> Pin<Box<dyn Future<Output = StorageResult<VectorStoreInfo>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Provided Methods§

Source

fn capabilities(&self) -> &'static VectorStoreCapabilities

Declare what this backend supports (called at runtime policy construction).

Default returns a conservative baseline with all optional features disabled, preserving backward compatibility for existing implementations. Backends that support filter pushdown, batch search, quantization, or in-place update should override this and return their own &'static VectorStoreCapabilities.

Source

fn search_with_filter<'life0, 'async_trait>( &'life0 self, request: VectorSearchRequest, filter: VectorMetadataFilter, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<VectorSearchHit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Search with metadata pre-filter.

Default: delegates to [search] when the filter carries no predicates; returns StorageError::Unsupported otherwise. Backends with native filter pushdown should override this method and set supports_filter = true in their VectorStoreCapabilities.

Callers must check capabilities().supports_filter before calling; the runtime layer is responsible for post-filtering when native pushdown is absent.

Source

fn search_batch<'life0, 'async_trait>( &'life0 self, requests: Vec<VectorSearchRequest>, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<Vec<VectorSearchHit>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Search with N query vectors in one round-trip (HyDE fan-out, multi-query).

Default: sequential calls to [search]. Backends that support native batch search (amortising index-walk overhead) should override this and set supports_batch_search = true in their VectorStoreCapabilities.

Source

fn update<'life0, 'life1, 'async_trait>( &'life0 self, subject_id: Uuid, kind: SubstrateKind, namespace: &'life1 str, embedding: Vec<f32>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Re-embed an existing entry in place.

Default: delete then insert. Backends that support atomic in-place update should override this and set supports_update = true in their VectorStoreCapabilities.

Implementors§