pub trait VectorStore:
Send
+ Sync
+ 'static {
Show 13 methods
// 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 { ... }
fn batch_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [Uuid],
namespace: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<HashSet<Uuid>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait { ... }
}Expand description
Storage capability for dense vector embeddings and similarity search.
Required Methods§
Sourcefn 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<'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,
Store one or more dense vectors for a subject, identified by field name.
Sourcefn 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 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,
Insert a batch of pre-assembled vector records in one call.
Sourcefn 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 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,
Delete all vectors associated with the given subject ID.
Sourcefn count<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<u64>> + 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,
Return the total number of vector entries in this store.
Sourcefn 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 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,
Run approximate nearest-neighbor search and return ranked hits.
Sourcefn info<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = StorageResult<VectorStoreInfo>> + 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,
Return index metadata and health statistics for this backend.
Sourcefn 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,
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,
Rebuild the ANN index, optionally scoped to a subset of entries.
Provided Methods§
Sourcefn capabilities(&self) -> &'static VectorStoreCapabilities
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.
Sourcefn 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_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 Self::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.
Sourcefn 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 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 Self::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.
Sourcefn 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 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.
Sourcefn 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,
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).
Default returns StorageError::Unsupported. Backends that implement
deletion must set supports_orphan_sweep = true and override this method.
Sourcefn batch_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [Uuid],
namespace: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<HashSet<Uuid>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn batch_exists<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
ids: &'life1 [Uuid],
namespace: &'life2 str,
) -> Pin<Box<dyn Future<Output = StorageResult<HashSet<Uuid>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Check which of the given subject IDs already have embeddings in this store for the specified namespace.
Returns a HashSet of IDs that are present. IDs not in the returned set
have no embedding. Default returns StorageError::Unsupported; backends
that support fast bulk existence checks should override this method.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".