Trait lance_index::vector::graph::VectorStorage
source · pub trait VectorStorage: Send + Sync {
// Required methods
fn as_any(&self) -> &dyn Any;
fn len(&self) -> usize;
fn row_ids(&self) -> &[u64];
fn metric_type(&self) -> MetricType;
fn dist_calculator(&self, query: &[f32]) -> Box<dyn DistCalculator>;
// Provided method
fn is_empty(&self) -> bool { ... }
}Expand description
Vector storage to back a graph. Vector Storage is the abstraction to store the vectors.
It can be in-memory raw vectors or on disk PQ code.
It abstracts away the logic to compute the distance between vectors.
TODO: should we rename this to “VectorDistance”?;
Required Methods§
fn as_any(&self) -> &dyn Any
fn len(&self) -> usize
fn row_ids(&self) -> &[u64]
sourcefn metric_type(&self) -> MetricType
fn metric_type(&self) -> MetricType
Return the metric type of the vectors.
sourcefn dist_calculator(&self, query: &[f32]) -> Box<dyn DistCalculator>
fn dist_calculator(&self, query: &[f32]) -> Box<dyn DistCalculator>
Create a [DistCalculator] to compute the distance between the query.
Using dist calcualtor can be more efficient as it can pre-compute some values.