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§

source

fn as_any(&self) -> &dyn Any

source

fn len(&self) -> usize

source

fn row_ids(&self) -> &[u64]

source

fn metric_type(&self) -> MetricType

Return the metric type of the vectors.

source

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.

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if this graph is empty.

Implementors§