Trait VectorIndex
pub trait VectorIndex {
// Required methods
fn insert_embedding<P>(
&self,
registry: &P,
e: EmbeddingInsert<'_>,
) -> Result<(), VectorIndexError>
where P: EmbeddingProvenance;
fn knn<P>(
&self,
registry: &P,
task: TaskKind,
query: &[f32],
k: usize,
platform: &str,
) -> Result<Vec<KnnHit>, VectorIndexError>
where P: EmbeddingProvenance;
fn stale_embedding_assets<P>(
&self,
registry: &P,
task: TaskKind,
platform: &str,
) -> Result<Vec<String>, VectorIndexError>
where P: EmbeddingProvenance;
}Expand description
The store port the ML layer writes embeddings into and ranks them from.
Partitioned by (platform, model_version): a query answers from the current canonical
version only, so a stale embedding (an older version, left over after a model swap) is excluded
structurally until regenerate_stale replaces it. The production
implementor is the library catalog; an implementation must honour these laws:
insert_embeddingrefuses whatEmbeddingProvenance::check_insertrefuses and a vector whose length is not the declared dimension, and replaces any prior embedding for the same(asset, task, platform);knnreturns hits nearest-first from theplatformpartition at the registry’s current canonical version only;stale_embedding_assetslists, sorted, the assets in theplatformpartition whose stored version trails the canonical one.
Required Methods§
fn insert_embedding<P>(
&self,
registry: &P,
e: EmbeddingInsert<'_>,
) -> Result<(), VectorIndexError>where
P: EmbeddingProvenance,
fn insert_embedding<P>(
&self,
registry: &P,
e: EmbeddingInsert<'_>,
) -> Result<(), VectorIndexError>where
P: EmbeddingProvenance,
Insert (or replace) one provenanced embedding.
fn knn<P>(
&self,
registry: &P,
task: TaskKind,
query: &[f32],
k: usize,
platform: &str,
) -> Result<Vec<KnnHit>, VectorIndexError>where
P: EmbeddingProvenance,
fn knn<P>(
&self,
registry: &P,
task: TaskKind,
query: &[f32],
k: usize,
platform: &str,
) -> Result<Vec<KnnHit>, VectorIndexError>where
P: EmbeddingProvenance,
The k nearest neighbours of query in task’s current canonical platform partition.
fn stale_embedding_assets<P>(
&self,
registry: &P,
task: TaskKind,
platform: &str,
) -> Result<Vec<String>, VectorIndexError>where
P: EmbeddingProvenance,
fn stale_embedding_assets<P>(
&self,
registry: &P,
task: TaskKind,
platform: &str,
) -> Result<Vec<String>, VectorIndexError>where
P: EmbeddingProvenance,
The regeneration work-list: assets in task’s platform partition whose embedding is
stale under registry, sorted by asset id.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementors§
impl VectorIndex for DatabaseDriver
The catalog is the production VectorIndex: each port method is the inherent method of the
same name, with a SQLite failure type-erased into VectorIndexError::Store.