pub struct BfTreeProvider<T, Q = QuantVectorProvider>where
T: VectorRepr,{ /* private fields */ }Expand description
An Bf-tree based implementation of a DataProvider built around the idea of having up to
two layers of vector stores: a full-precision store and an optional quantized store.
This provider uses the identity mapping between external and internal vector IDs.
§Type Parameters:
-
T: The primitive element type of the full-precision vector. This is typically some type likef32orhalf::f16. -
Q: The full type of the quant vector store. This is not constrained by a trait and rather relies on implementation for several concrete types, including:QuantVectorProvider: A Bf-Tree based spherical quantized vector store.NoStore: Disable quantization altogether. Note that this disables all methods reached through quantization based [Accessor]s at compile-time.
§Indexing Strategies
-
FullPrecision: Only retrieves data from the full-precision portion of the index. No quantized vectors are used. During search, start points are filtered from the final results. -
Quantized: Performs all operations (search, pruning, insert) entirely in the quantized space using spherical distance functions. Post-processing copies candidate IDs forward without reranking. Fastest option — full-precision vectors are not touched at query time.
§Examples
The following code demonstrates how to instantiate and use the BfTreeProvider in
a number of different scenarios.
§Full-Precision Only - No Deletes
This example demonstrates how to create a BfTreeProvider that only supports
full-precision vectors.
use diskann_bftree::provider::{
BfTreeProvider, BfTreeProviderParameters
};
use diskann_bftree::NoStore;
use diskann_vector::distance::Metric;
use diskann_utils::views::{Init, Matrix};
use bf_tree::Config;
use std::num::NonZeroUsize;
let parameters = BfTreeProviderParameters {
max_points: 5,
num_start_points: NonZeroUsize::new(1).unwrap(),
dim: 4,
metric: Metric::L2,
max_degree: 32,
vector_provider_config: Config::default(),
quant_vector_provider_config: Config::default(),
neighbor_list_provider_config: Config::default(),
graph_params: None,
use_snapshot: false,
};
// Create a table that supports 5 points and 1 start point.
let start_points = Matrix::new(Init(|| 0.0f32), 1, 4);
let provider = BfTreeProvider::<f32, _>::new(
parameters,
start_points.as_view(),
NoStore,
);§Full-Precision and Spherical Quantization
To create a two-level provider with a spherical quantization-based quant vector store,
a Poly<dyn Quantizer> can be supplied for the quant_precursor argument, as this
implements the CreateQuantProvider trait.
use diskann_quantization::{
alloc::{GlobalAllocator, Poly, poly},
algorithms::TransformKind,
spherical::{iface, SphericalQuantizer, SupportedMetric, PreScale},
};
use diskann_utils::views::{Init, Matrix};
use diskann_bftree::provider::{
BfTreeProvider, BfTreeProviderParameters
};
use diskann_vector::distance::Metric;
use bf_tree::Config;
use std::num::NonZeroUsize;
use rand::rngs::StdRng;
use rand::SeedableRng;
let dim = 4;
let data = Matrix::new(Init(|| 1.0f32), 4, dim);
let mut rng = StdRng::seed_from_u64(42);
let sq = SphericalQuantizer::train(
data.as_view(), TransformKind::Null,
SupportedMetric::SquaredL2, PreScale::None,
&mut rng, GlobalAllocator,
).unwrap();
let imp = iface::Impl::<1>::new(sq).unwrap();
let poly = Poly::new(imp, GlobalAllocator).unwrap();
let quantizer: Poly<dyn iface::Quantizer> = poly!(iface::Quantizer, poly);
let parameters = BfTreeProviderParameters {
max_points: 5,
num_start_points: NonZeroUsize::new(1).unwrap(),
dim: 4,
metric: Metric::L2,
max_degree: 32,
vector_provider_config: Config::default(),
quant_vector_provider_config: Config::default(),
neighbor_list_provider_config: Config::default(),
graph_params: None,
use_snapshot: false,
};
// Create a table that supports 5 points and 1 start point.
let start_points = Matrix::new(Init(|| 0.0f32), 1, 4);
let provider = BfTreeProvider::<f32, _>::new(
parameters,
start_points.as_view(),
quantizer,
);Implementations§
Source§impl<T, Q> BfTreeProvider<T, Q>where
T: VectorRepr,
impl<T, Q> BfTreeProvider<T, Q>where
T: VectorRepr,
Sourcepub fn new<TQ>(
params: BfTreeProviderParameters,
start_points: MatrixView<'_, T>,
quant_precursor: TQ,
) -> ANNResult<Self>where
Self: StartPoint<T>,
TQ: CreateQuantProvider<Target = Q>,
pub fn new<TQ>(
params: BfTreeProviderParameters,
start_points: MatrixView<'_, T>,
quant_precursor: TQ,
) -> ANNResult<Self>where
Self: StartPoint<T>,
TQ: CreateQuantProvider<Target = Q>,
Construct a new data provider with start points initialized.
This is the primary constructor for BfTreeProvider where start points are known from the
beginning. It creates the provider and sets the start points in one operation.
§Arguments
params: An instance ofBfTreeProviderParameterscollecting shared configuration information.start_points: A matrix view containing the start point vectors. The number of rows must matchparams.num_start_points.get().quant_precursor: A precursor type for the quantizer layer.
§Type Constraints
Self: StartPoint<T>- The provider must implement theStartPointtrait.
Sourcepub fn starting_points(&self) -> ANNResult<Vec<u32>>
pub fn starting_points(&self) -> ANNResult<Vec<u32>>
Return a vector of starting points.
Sourcepub fn iter(&self) -> Range<u32>
pub fn iter(&self) -> Range<u32>
An iterator over all ids including start points (even if they are deleted).
pub fn num_start_points(&self) -> usize
Sourcepub fn max_points(&self) -> usize
pub fn max_points(&self) -> usize
Return the maximum number of points (excluding frozen/start points)
Sourcepub fn max_degree(&self) -> u32
pub fn max_degree(&self) -> u32
Return the maximum degree from the neighbor provider
Source§impl<T> BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
impl<T> BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
Sourcepub fn counts_for_get_vector(&self) -> (usize, usize)
pub fn counts_for_get_vector(&self) -> (usize, usize)
Return the number of vector reads for full-precision and quant-vectors respectively
Source§impl<T> BfTreeProvider<T, NoStore>where
T: VectorRepr,
impl<T> BfTreeProvider<T, NoStore>where
T: VectorRepr,
Sourcepub fn counts_for_get_vector(&self) -> (usize, usize)
pub fn counts_for_get_vector(&self) -> (usize, usize)
Return the number of vector reads for full-precision and quant-vectors respectively
Source§impl<T, Q> BfTreeProvider<T, Q>where
T: VectorRepr,
Q: AsyncFriendly,
impl<T, Q> BfTreeProvider<T, Q>where
T: VectorRepr,
Q: AsyncFriendly,
pub fn neighbors(&self) -> &NeighborProvider<u32>
Trait Implementations§
Source§impl<T, Q> DataProvider for BfTreeProvider<T, Q>where
T: VectorRepr,
Q: AsyncFriendly,
impl<T, Q> DataProvider for BfTreeProvider<T, Q>where
T: VectorRepr,
Q: AsyncFriendly,
type Context = DefaultContext
type InternalId = u32
type ExternalId = u32
type Error = ANNError
Source§type Guard = NoopGuard<u32>
type Guard = NoopGuard<u32>
SetElement::set_element to notify self if an
operation fails. Read moreSource§fn to_internal_id(
&self,
_context: &DefaultContext,
gid: &Self::ExternalId,
) -> Result<Self::InternalId, Self::Error>
fn to_internal_id( &self, _context: &DefaultContext, gid: &Self::ExternalId, ) -> Result<Self::InternalId, Self::Error>
Source§fn to_external_id(
&self,
_context: &DefaultContext,
id: Self::InternalId,
) -> Result<Self::ExternalId, Self::Error>
fn to_external_id( &self, _context: &DefaultContext, id: Self::InternalId, ) -> Result<Self::ExternalId, Self::Error>
Source§impl<'a, T, Q> DefaultPostProcessor<'a, BfTreeProvider<T, Q>, &'a [T]> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
impl<'a, T, Q> DefaultPostProcessor<'a, BfTreeProvider<T, Q>, &'a [T]> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
Source§fn default_post_processor(&self) -> Self::Processor
fn default_post_processor(&self) -> Self::Processor
Source§impl<'a, T> DefaultPostProcessor<'a, BfTreeProvider<T>, &'a [T]> for Quantizedwhere
T: VectorRepr,
impl<'a, T> DefaultPostProcessor<'a, BfTreeProvider<T>, &'a [T]> for Quantizedwhere
T: VectorRepr,
Source§fn default_post_processor(&self) -> Self::Processor
fn default_post_processor(&self) -> Self::Processor
Source§impl<T, Q> Delete for BfTreeProvider<T, Q>where
T: VectorRepr,
Q: AsyncFriendly + DeleteQuant,
Hard-delete implementation for BfTreeProvider.
impl<T, Q> Delete for BfTreeProvider<T, Q>where
T: VectorRepr,
Q: AsyncFriendly + DeleteQuant,
Hard-delete implementation for BfTreeProvider.
This provider performs hard deletes: vector data is immediately and irrecoverably erased
from the underlying bf-tree storage when Delete::delete is called. When a quantized
store is present, both the full-precision and quantized entries are removed.
This has an important consequence for inplace delete: the
[InplaceDeleteMethod::VisitedAndTopK] strategy is incompatible with this provider
because it requires reading the deleted vector’s data (via
InplaceDeleteStrategy::get_delete_element) after the delete has already been committed.
Use [InplaceDeleteMethod::OneHop] or [InplaceDeleteMethod::TwoHopAndOneHop] instead,
as these strategies only require neighbor topology (which remains accessible).
Source§fn release(
&self,
_context: &Self::Context,
_id: Self::InternalId,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn release( &self, _context: &Self::Context, _id: Self::InternalId, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn delete(
&self,
_context: &Self::Context,
gid: &Self::ExternalId,
) -> impl Future<Output = Result<(), Self::Error>> + Send
fn delete( &self, _context: &Self::Context, gid: &Self::ExternalId, ) -> impl Future<Output = Result<(), Self::Error>> + Send
Source§fn status_by_external_id(
&self,
context: &Self::Context,
gid: &Self::ExternalId,
) -> impl Future<Output = Result<ElementStatus, Self::Error>> + Send
fn status_by_external_id( &self, context: &Self::Context, gid: &Self::ExternalId, ) -> impl Future<Output = Result<ElementStatus, Self::Error>> + Send
Source§fn status_by_internal_id(
&self,
_context: &Self::Context,
id: Self::InternalId,
) -> impl Future<Output = Result<ElementStatus, Self::Error>> + Send
fn status_by_internal_id( &self, _context: &Self::Context, id: Self::InternalId, ) -> impl Future<Output = Result<ElementStatus, Self::Error>> + Send
Source§fn statuses_unordered<Itr, F>(
&self,
context: &Self::Context,
itr: Itr,
f: F,
) -> impl Future<Output = Result<(), Self::Error>> + Sendwhere
Itr: Iterator<Item = Self::InternalId> + Send,
F: FnMut(Result<ElementStatus, Self::Error>, Self::InternalId) + Send,
fn statuses_unordered<Itr, F>(
&self,
context: &Self::Context,
itr: Itr,
f: F,
) -> impl Future<Output = Result<(), Self::Error>> + Sendwhere
Itr: Iterator<Item = Self::InternalId> + Send,
F: FnMut(Result<ElementStatus, Self::Error>, Self::InternalId) + Send,
status_by_internal_id.Source§impl<T, Q> HasId for BfTreeProvider<T, Q>where
T: VectorRepr,
Q: AsyncFriendly,
impl<T, Q> HasId for BfTreeProvider<T, Q>where
T: VectorRepr,
Q: AsyncFriendly,
Source§impl<T, Q> InplaceDeleteStrategy<BfTreeProvider<T, Q>> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
Inplace delete strategy using full-precision vectors.
impl<T, Q> InplaceDeleteStrategy<BfTreeProvider<T, Q>> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
Inplace delete strategy using full-precision vectors.
§Compatibility
This strategy is used with [InplaceDeleteMethod::OneHop] and
[InplaceDeleteMethod::TwoHopAndOneHop]. It is not compatible with
[InplaceDeleteMethod::VisitedAndTopK] because BfTreeProvider performs hard deletes —
the vector data is erased before get_delete_element is called, causing it to fail.
Source§type DeleteElementError = ANNError
type DeleteElementError = ANNError
Source§type DeleteElement<'a> = &'a [T]
type DeleteElement<'a> = &'a [T]
SearchStrategy. Read moreSource§type PruneStrategy = FullPrecision
type PruneStrategy = FullPrecision
Source§type DeleteSearchAccessor<'a> = FullAccessor<'a, T, Q>
type DeleteSearchAccessor<'a> = FullAccessor<'a, T, Q>
Source§type SearchPostProcessor = CopyIds
type SearchPostProcessor = CopyIds
Source§type SearchStrategy = FullPrecision
type SearchStrategy = FullPrecision
Source§fn search_strategy(&self) -> Self::SearchStrategy
fn search_strategy(&self) -> Self::SearchStrategy
Source§fn prune_strategy(&self) -> Self::PruneStrategy
fn prune_strategy(&self) -> Self::PruneStrategy
Source§fn search_post_processor(&self) -> Self::SearchPostProcessor
fn search_post_processor(&self) -> Self::SearchPostProcessor
Source§async fn get_delete_element<'a>(
&'a self,
provider: &'a BfTreeProvider<T, Q>,
_context: &'a DefaultContext,
id: u32,
) -> Result<Self::DeleteElementGuard, Self::DeleteElementError>
async fn get_delete_element<'a>( &'a self, provider: &'a BfTreeProvider<T, Q>, _context: &'a DefaultContext, id: u32, ) -> Result<Self::DeleteElementGuard, Self::DeleteElementError>
Source§impl<T> InplaceDeleteStrategy<BfTreeProvider<T>> for Quantizedwhere
T: VectorRepr,
Inplace delete strategy using quantized vectors.
impl<T> InplaceDeleteStrategy<BfTreeProvider<T>> for Quantizedwhere
T: VectorRepr,
Inplace delete strategy using quantized vectors.
§Compatibility
Same constraint as FullPrecision’s impl: not compatible with
[InplaceDeleteMethod::VisitedAndTopK] due to hard deletes.
Source§type DeleteElementError = ANNError
type DeleteElementError = ANNError
Source§type DeleteElement<'a> = &'a [T]
type DeleteElement<'a> = &'a [T]
SearchStrategy. Read moreSource§type PruneStrategy = Quantized
type PruneStrategy = Quantized
Source§type DeleteSearchAccessor<'a> = QuantAccessor<'a, T>
type DeleteSearchAccessor<'a> = QuantAccessor<'a, T>
Source§type SearchPostProcessor = Rerank
type SearchPostProcessor = Rerank
Source§type SearchStrategy = Quantized
type SearchStrategy = Quantized
Source§fn search_strategy(&self) -> Self::SearchStrategy
fn search_strategy(&self) -> Self::SearchStrategy
Source§fn prune_strategy(&self) -> Self::PruneStrategy
fn prune_strategy(&self) -> Self::PruneStrategy
Source§fn search_post_processor(&self) -> Self::SearchPostProcessor
fn search_post_processor(&self) -> Self::SearchPostProcessor
Source§async fn get_delete_element<'a>(
&'a self,
provider: &'a BfTreeProvider<T, QuantVectorProvider>,
_context: &'a DefaultContext,
id: u32,
) -> Result<Self::DeleteElementGuard, Self::DeleteElementError>
async fn get_delete_element<'a>( &'a self, provider: &'a BfTreeProvider<T, QuantVectorProvider>, _context: &'a DefaultContext, id: u32, ) -> Result<Self::DeleteElementGuard, Self::DeleteElementError>
Source§impl<'a, T, Q> InsertStrategy<'a, BfTreeProvider<T, Q>, &'a [T]> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
impl<'a, T, Q> InsertStrategy<'a, BfTreeProvider<T, Q>, &'a [T]> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
Source§type PruneStrategy = FullPrecision
type PruneStrategy = FullPrecision
Source§fn prune_strategy(&self) -> Self::PruneStrategy
fn prune_strategy(&self) -> Self::PruneStrategy
Source§fn insert_search_accessor(
&'a self,
provider: &'a Provider,
context: &'a <Provider as DataProvider>::Context,
vector: T,
) -> Result<Self::SearchAccessor, Self::SearchAccessorError>
fn insert_search_accessor( &'a self, provider: &'a Provider, context: &'a <Provider as DataProvider>::Context, vector: T, ) -> Result<Self::SearchAccessor, Self::SearchAccessorError>
SearchAccessor. Read moreSource§impl<'a, T> InsertStrategy<'a, BfTreeProvider<T>, &'a [T]> for Quantizedwhere
T: VectorRepr,
impl<'a, T> InsertStrategy<'a, BfTreeProvider<T>, &'a [T]> for Quantizedwhere
T: VectorRepr,
Source§type PruneStrategy = Quantized
type PruneStrategy = Quantized
Source§fn prune_strategy(&self) -> Self::PruneStrategy
fn prune_strategy(&self) -> Self::PruneStrategy
Source§fn insert_search_accessor(
&'a self,
provider: &'a Provider,
context: &'a <Provider as DataProvider>::Context,
vector: T,
) -> Result<Self::SearchAccessor, Self::SearchAccessorError>
fn insert_search_accessor( &'a self, provider: &'a Provider, context: &'a <Provider as DataProvider>::Context, vector: T, ) -> Result<Self::SearchAccessor, Self::SearchAccessorError>
SearchAccessor. Read moreSource§impl<T, Q> IntoIterator for &BfTreeProvider<T, Q>where
T: VectorRepr,
Allow &BfTreeProvider to implement IntoIter
impl<T, Q> IntoIterator for &BfTreeProvider<T, Q>where
T: VectorRepr,
Allow &BfTreeProvider to implement IntoIter
Source§impl<T> LoadWith<String> for BfTreeProvider<T, NoStore>where
T: VectorRepr,
impl<T> LoadWith<String> for BfTreeProvider<T, NoStore>where
T: VectorRepr,
Source§impl<T> LoadWith<String> for BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
impl<T> LoadWith<String> for BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
Source§impl<T, Q, B> MultiInsertStrategy<BfTreeProvider<T, Q>, B> for FullPrecision
impl<T, Q, B> MultiInsertStrategy<BfTreeProvider<T, Q>, B> for FullPrecision
Source§type Seed = Builder<u32, Ref<[T]>>
type Seed = Builder<u32, Ref<[T]>>
B for faster access.Source§type FinishError = Infallible
type FinishError = Infallible
finish.Source§type PruneStrategy = FullPrecision
type PruneStrategy = FullPrecision
PruneStrategy used for pruning.Source§type InsertStrategy = FullPrecision
type InsertStrategy = FullPrecision
InsertStrategy for most insertion related decisions.Source§fn insert_strategy(&self) -> Self::InsertStrategy
fn insert_strategy(&self) -> Self::InsertStrategy
InsertStrategy.Source§fn finish<Itr>(
&self,
_provider: &BfTreeProvider<T, Q>,
_ctx: &DefaultContext,
batch: &Arc<B>,
ids: Itr,
) -> impl Future<Output = Result<Self::Seed, Self::FinishError>> + Send
fn finish<Itr>( &self, _provider: &BfTreeProvider<T, Q>, _ctx: &DefaultContext, batch: &Arc<B>, ids: Itr, ) -> impl Future<Output = Result<Self::Seed, Self::FinishError>> + Send
batch and the associated internal IDs into an intermediate seed. Read moreSource§fn seeded_prune_accessor<'a>(
&'a self,
provider: &'a BfTreeProvider<T, Q>,
_context: &'a DefaultContext,
seed: &'a Self::Seed,
capacity: usize,
) -> ANNResult<FullPruneAccessor<'a, T, Q>>
fn seeded_prune_accessor<'a>( &'a self, provider: &'a BfTreeProvider<T, Q>, _context: &'a DefaultContext, seed: &'a Self::Seed, capacity: usize, ) -> ANNResult<FullPruneAccessor<'a, T, Q>>
Source§impl<T, B> MultiInsertStrategy<BfTreeProvider<T>, B> for Quantized
impl<T, B> MultiInsertStrategy<BfTreeProvider<T>, B> for Quantized
Source§type FinishError = Infallible
type FinishError = Infallible
finish.Source§type PruneStrategy = Quantized
type PruneStrategy = Quantized
PruneStrategy used for pruning.Source§type InsertStrategy = Quantized
type InsertStrategy = Quantized
InsertStrategy for most insertion related decisions.Source§fn insert_strategy(&self) -> Self::InsertStrategy
fn insert_strategy(&self) -> Self::InsertStrategy
InsertStrategy.Source§fn finish<Itr>(
&self,
_provider: &BfTreeProvider<T, QuantVectorProvider>,
_ctx: &DefaultContext,
_batch: &Arc<B>,
_ids: Itr,
) -> impl Future<Output = Result<Self::Seed, Self::FinishError>> + Send
fn finish<Itr>( &self, _provider: &BfTreeProvider<T, QuantVectorProvider>, _ctx: &DefaultContext, _batch: &Arc<B>, _ids: Itr, ) -> impl Future<Output = Result<Self::Seed, Self::FinishError>> + Send
batch and the associated internal IDs into an intermediate seed. Read moreSource§fn seeded_prune_accessor<'a>(
&'a self,
provider: &'a BfTreeProvider<T, QuantVectorProvider>,
_context: &'a DefaultContext,
_seed: &'a (),
capacity: usize,
) -> ANNResult<QuantPruneAccessor<'a, T>>
fn seeded_prune_accessor<'a>( &'a self, provider: &'a BfTreeProvider<T, QuantVectorProvider>, _context: &'a DefaultContext, _seed: &'a (), capacity: usize, ) -> ANNResult<QuantPruneAccessor<'a, T>>
Source§impl<T, Q> PruneStrategy<BfTreeProvider<T, Q>> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
impl<T, Q> PruneStrategy<BfTreeProvider<T, Q>> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
Source§type PruneAccessor<'a> = FullPruneAccessor<'a, T, Q>
type PruneAccessor<'a> = FullPruneAccessor<'a, T, Q>
PruneAccessor that is used during index construction.Source§type PruneAccessorError = Infallible
type PruneAccessorError = Infallible
Source§fn prune_accessor<'a>(
&'a self,
provider: &'a BfTreeProvider<T, Q>,
_context: &'a DefaultContext,
capacity: usize,
) -> Result<Self::PruneAccessor<'a>, Self::PruneAccessorError>
fn prune_accessor<'a>( &'a self, provider: &'a BfTreeProvider<T, Q>, _context: &'a DefaultContext, capacity: usize, ) -> Result<Self::PruneAccessor<'a>, Self::PruneAccessorError>
PruneAccessor. Argument capacity provides an upper bound on the
length of the iterator passed to PruneAccessor::fill.Source§impl<T> PruneStrategy<BfTreeProvider<T>> for Quantizedwhere
T: VectorRepr,
impl<T> PruneStrategy<BfTreeProvider<T>> for Quantizedwhere
T: VectorRepr,
Source§type PruneAccessor<'a> = QuantPruneAccessor<'a, T>
type PruneAccessor<'a> = QuantPruneAccessor<'a, T>
PruneAccessor that is used during index construction.Source§type PruneAccessorError = ANNError
type PruneAccessorError = ANNError
Source§fn prune_accessor<'a>(
&'a self,
provider: &'a BfTreeProvider<T, QuantVectorProvider>,
_context: &'a DefaultContext,
capacity: usize,
) -> Result<Self::PruneAccessor<'a>, Self::PruneAccessorError>
fn prune_accessor<'a>( &'a self, provider: &'a BfTreeProvider<T, QuantVectorProvider>, _context: &'a DefaultContext, capacity: usize, ) -> Result<Self::PruneAccessor<'a>, Self::PruneAccessorError>
PruneAccessor. Argument capacity provides an upper bound on the
length of the iterator passed to PruneAccessor::fill.Source§impl<T> SaveWith<String> for BfTreeProvider<T, NoStore>where
T: VectorRepr,
impl<T> SaveWith<String> for BfTreeProvider<T, NoStore>where
T: VectorRepr,
Source§impl<T> SaveWith<String> for BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
impl<T> SaveWith<String> for BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
Source§impl<'a, T, Q> SearchStrategy<'a, BfTreeProvider<T, Q>, &'a [T]> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
Perform a search entirely in the full-precision space.
impl<'a, T, Q> SearchStrategy<'a, BfTreeProvider<T, Q>, &'a [T]> for FullPrecisionwhere
T: VectorRepr,
Q: AsyncFriendly,
Perform a search entirely in the full-precision space.
Starting points are not filtered out of the final results.
Source§type SearchAccessor = FullAccessor<'a, T, Q>
type SearchAccessor = FullAccessor<'a, T, Q>
Self during the greedy
graph search. The query will be provided to the accessor exactly once during search
to construct the query computer.Source§type SearchAccessorError = Infallible
type SearchAccessorError = Infallible
Source§fn search_accessor(
&'a self,
provider: &'a BfTreeProvider<T, Q>,
_context: &'a DefaultContext,
query: &'a [T],
) -> Result<Self::SearchAccessor, Self::SearchAccessorError>
fn search_accessor( &'a self, provider: &'a BfTreeProvider<T, Q>, _context: &'a DefaultContext, query: &'a [T], ) -> Result<Self::SearchAccessor, Self::SearchAccessorError>
Source§impl<'a, T> SearchStrategy<'a, BfTreeProvider<T>, &'a [T]> for Quantizedwhere
T: VectorRepr,
Perform a search entirely in the quantized space.
impl<'a, T> SearchStrategy<'a, BfTreeProvider<T>, &'a [T]> for Quantizedwhere
T: VectorRepr,
Perform a search entirely in the quantized space.
Starting points are not filtered out of the final results.
Source§type SearchAccessor = QuantAccessor<'a, T>
type SearchAccessor = QuantAccessor<'a, T>
Self during the greedy
graph search. The query will be provided to the accessor exactly once during search
to construct the query computer.Source§type SearchAccessorError = ANNError
type SearchAccessorError = ANNError
Source§fn search_accessor(
&'a self,
provider: &'a BfTreeProvider<T, QuantVectorProvider>,
_context: &'a DefaultContext,
query: &'a [T],
) -> Result<Self::SearchAccessor, Self::SearchAccessorError>
fn search_accessor( &'a self, provider: &'a BfTreeProvider<T, QuantVectorProvider>, _context: &'a DefaultContext, query: &'a [T], ) -> Result<Self::SearchAccessor, Self::SearchAccessorError>
Source§impl<T> SetElement<&[T]> for BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
Assign to both the full-precision and quant vector stores
impl<T> SetElement<&[T]> for BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
Assign to both the full-precision and quant vector stores
Source§fn set_element(
&self,
_context: &Self::Context,
id: &u32,
element: &[T],
) -> impl Future<Output = Result<Self::Guard, Self::SetError>> + Send
fn set_element( &self, _context: &Self::Context, id: &u32, element: &[T], ) -> impl Future<Output = Result<Self::Guard, Self::SetError>> + Send
Store the provided element in both the full-precision and quant vector stores.
Full-precision is written first as the authoritative store. This ensures that if the quant write fails, the worst case is a vector reachable in full-precision but not yet in quantized search (benign), rather than a quantized ghost with no full-precision backing data.
Source§impl<T> SetElement<&[T]> for BfTreeProvider<T, NoStore>where
T: VectorRepr,
Assign to just the full-precision store
impl<T> SetElement<&[T]> for BfTreeProvider<T, NoStore>where
T: VectorRepr,
Assign to just the full-precision store
impl<T> StartPoint<T> for BfTreeProvider<T, QuantVectorProvider>where
T: VectorRepr,
Set start points for the BfTreeProvider with quantization.
This implementation sets both the full-precision and quantized vectors for each start point, as well as initializing empty neighbor lists.
impl<T> StartPoint<T> for BfTreeProvider<T, NoStore>where
T: VectorRepr,
Set start points for the BfTreeProvider without quantization.
This implementation sets the full-precision vectors for each start point and initializes empty neighbor lists.
Auto Trait Implementations§
impl<T, Q = QuantVectorProvider> !Freeze for BfTreeProvider<T, Q>
impl<T, Q = QuantVectorProvider> !RefUnwindSafe for BfTreeProvider<T, Q>
impl<T, Q = QuantVectorProvider> !UnwindSafe for BfTreeProvider<T, Q>
impl<T, Q> Send for BfTreeProvider<T, Q>where
Q: Send,
impl<T, Q> Sync for BfTreeProvider<T, Q>where
Q: Sync,
impl<T, Q> Unpin for BfTreeProvider<T, Q>
impl<T, Q> UnsafeUnpin for BfTreeProvider<T, Q>where
Q: UnsafeUnpin,
Blanket Implementations§
impl<T> AsyncFriendly for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more