pub trait VectorIndex: Send + Sync {
// Required methods
fn descriptor(&self) -> &VectorIndexDescriptor;
fn status(&self) -> VectorIndexStatus;
fn replace_partition<'life0, 'life1, 'async_trait>(
&'life0 self,
partition: &'life1 str,
records: Vec<VectorRecord>,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn remove_partition<'life0, 'life1, 'async_trait>(
&'life0 self,
partition: &'life1 str,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn search<'life0, 'async_trait>(
&'life0 self,
request: VectorSearchRequest,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorSearchResult>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
// Provided methods
fn change_token(&self) -> Option<VectorIndexChangeToken> { ... }
fn observe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexObservation>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait { ... }
fn mutation_consistency(&self) -> VectorMutationConsistency { ... }
fn replace_partition_if_revision<'life0, 'life1, 'async_trait>(
&'life0 self,
_partition: &'life1 str,
_expected_revision: VectorRevision,
_records: Vec<VectorRecord>,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
fn remove_partition_if_revision<'life0, 'life1, 'async_trait>(
&'life0 self,
_partition: &'life1 str,
_expected_revision: VectorRevision,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait { ... }
}Expand description
A bounded vector index whose content and lifecycle are owned by its caller.
Partitions are the atomic mutation unit. Implementations must make a successful replacement visible in one revision and must not expose a partially constructed partition to concurrent searches.
Required Methods§
Sourcefn descriptor(&self) -> &VectorIndexDescriptor
fn descriptor(&self) -> &VectorIndexDescriptor
Return the immutable shape and resource limits of this index.
Sourcefn status(&self) -> VectorIndexStatus
fn status(&self) -> VectorIndexStatus
Return the latest locally observed status without waiting for I/O.
This compatibility accessor can be stale for durable or remote
backends. Use Self::observe when the result guards correctness.
Sourcefn replace_partition<'life0, 'life1, 'async_trait>(
&'life0 self,
partition: &'life1 str,
records: Vec<VectorRecord>,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replace_partition<'life0, 'life1, 'async_trait>(
&'life0 self,
partition: &'life1 str,
records: Vec<VectorRecord>,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically replace every record in partition.
Replacing an existing partition with an empty record list removes it. Replacing a missing partition with an empty list is a no-op.
Sourcefn remove_partition<'life0, 'life1, 'async_trait>(
&'life0 self,
partition: &'life1 str,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_partition<'life0, 'life1, 'async_trait>(
&'life0 self,
partition: &'life1 str,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically remove one partition. Missing partitions are a no-op.
Sourcefn search<'life0, 'async_trait>(
&'life0 self,
request: VectorSearchRequest,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorSearchResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn search<'life0, 'async_trait>(
&'life0 self,
request: VectorSearchRequest,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorSearchResult>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Search one immutable index revision.
Sourcefn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn clear<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Remove every partition. Clearing an empty index is a no-op.
Provided Methods§
Sourcefn change_token(&self) -> Option<VectorIndexChangeToken>
fn change_token(&self) -> Option<VectorIndexChangeToken>
Return exact evidence for the current revision of one index history.
The default preserves source compatibility but provides no continuity
proof. A backend may return Some only when every content mutation
advances the revision and its history identity changes whenever storage
is independently recreated or restored onto a divergent history.
Sourcefn observe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexObservation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn observe<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexObservation>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Observe one self-consistent published revision.
The conservative default exposes only the status compatibility view. Backends must override this method to expose an exact history token; doing so asserts that the status and token were read atomically.
Sourcefn mutation_consistency(&self) -> VectorMutationConsistency
fn mutation_consistency(&self) -> VectorMutationConsistency
Return the strongest partition-mutation ordering contract implemented by this backend.
Sourcefn replace_partition_if_revision<'life0, 'life1, 'async_trait>(
&'life0 self,
_partition: &'life1 str,
_expected_revision: VectorRevision,
_records: Vec<VectorRecord>,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn replace_partition_if_revision<'life0, 'life1, 'async_trait>(
&'life0 self,
_partition: &'life1 str,
_expected_revision: VectorRevision,
_records: Vec<VectorRecord>,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically replace one partition only when the complete index still has
expected_revision.
Implementations advertising IndexRevisionCas must compare and mutate
at one linearization point. The default fails closed so a custom backend
cannot accidentally claim cross-writer ordering from a check-then-write.
Sourcefn remove_partition_if_revision<'life0, 'life1, 'async_trait>(
&'life0 self,
_partition: &'life1 str,
_expected_revision: VectorRevision,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn remove_partition_if_revision<'life0, 'life1, 'async_trait>(
&'life0 self,
_partition: &'life1 str,
_expected_revision: VectorRevision,
) -> Pin<Box<dyn Future<Output = VectorResult<VectorIndexStatus>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Atomically remove one partition only when the complete index still has
expected_revision.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".