pub trait VectorIndex {
// Required methods
fn insert_embedding<P: EmbeddingProvenance>(
&self,
registry: &P,
e: EmbeddingInsert<'_>,
) -> Result<(), VectorIndexError>;
fn knn<P: EmbeddingProvenance>(
&self,
registry: &P,
task: TaskKind,
query: &[f32],
k: usize,
platform: &str,
) -> Result<Vec<KnnHit>, VectorIndexError>;
fn stale_embedding_assets<P: EmbeddingProvenance>(
&self,
registry: &P,
task: TaskKind,
platform: &str,
) -> Result<Vec<String>, VectorIndexError>;
}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§
Sourcefn insert_embedding<P: EmbeddingProvenance>(
&self,
registry: &P,
e: EmbeddingInsert<'_>,
) -> Result<(), VectorIndexError>
fn insert_embedding<P: EmbeddingProvenance>( &self, registry: &P, e: EmbeddingInsert<'_>, ) -> Result<(), VectorIndexError>
Insert (or replace) one provenanced embedding.
Sourcefn knn<P: EmbeddingProvenance>(
&self,
registry: &P,
task: TaskKind,
query: &[f32],
k: usize,
platform: &str,
) -> Result<Vec<KnnHit>, VectorIndexError>
fn knn<P: EmbeddingProvenance>( &self, registry: &P, task: TaskKind, query: &[f32], k: usize, platform: &str, ) -> Result<Vec<KnnHit>, VectorIndexError>
The k nearest neighbours of query in task’s current canonical platform partition.
Sourcefn stale_embedding_assets<P: EmbeddingProvenance>(
&self,
registry: &P,
task: TaskKind,
platform: &str,
) -> Result<Vec<String>, VectorIndexError>
fn stale_embedding_assets<P: EmbeddingProvenance>( &self, registry: &P, task: TaskKind, platform: &str, ) -> Result<Vec<String>, VectorIndexError>
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".