Skip to main content

VectorStore

Trait VectorStore 

Source
pub trait VectorStore:
    Send
    + Sync
    + 'static {
    // Required methods
    fn insert<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        subject_id: Uuid,
        kind: SubstrateKind,
        namespace: &'life1 str,
        field: &'life2 str,
        vectors: Vec<Vec<f32>>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: '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, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        request: &'life1 VectorSearchRequest,
        filter: &'life2 VectorMetadataFilter,
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<VectorSearchHit>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn search_batch<'life0, 'life1, 'async_trait>(
        &'life0 self,
        requests: &'life1 [VectorSearchRequest],
    ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<StorageResult<Vec<VectorSearchHit>>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    fn update<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        subject_id: Uuid,
        kind: SubstrateKind,
        namespace: &'life1 str,
        field: &'life2 str,
        vectors: Vec<Vec<f32>>,
    ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait { ... }
    fn orphan_sweep<'life0, 'life1, 'async_trait>(
        &'life0 self,
        config: &'life1 OrphanSweepConfig,
    ) -> Pin<Box<dyn Future<Output = StorageResult<OrphanSweepResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}

Required Methods§

Source

fn insert<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, subject_id: Uuid, kind: SubstrateKind, namespace: &'life1 str, field: &'life2 str, vectors: Vec<Vec<f32>>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: '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, 'life1, 'life2, 'async_trait>( &'life0 self, request: &'life1 VectorSearchRequest, filter: &'life2 VectorMetadataFilter, ) -> Pin<Box<dyn Future<Output = StorageResult<Vec<VectorSearchHit>>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: '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.

A backend that claims supports_filter = true but does not override this method will trigger a debug_assert at runtime (ADR-044 §4).

Source

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

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

Default: sequential calls to [search], isolating per-query errors so one bad request does not abort the batch. Backends that support native batch search should override this and set supports_batch_search = true.

Source

fn update<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, subject_id: Uuid, kind: SubstrateKind, namespace: &'life1 str, field: &'life2 str, vectors: Vec<Vec<f32>>, ) -> Pin<Box<dyn Future<Output = StorageResult<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: '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.

Source

fn orphan_sweep<'life0, 'life1, 'async_trait>( &'life0 self, config: &'life1 OrphanSweepConfig, ) -> Pin<Box<dyn Future<Output = StorageResult<OrphanSweepResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Remove vectors with no live subject (orphan sweep, ADR-044).

Default returns StorageError::Unsupported. Backends that implement deletion must set supports_orphan_sweep = true and override this method.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§