pub struct NeighborProvider<I: VectorId + IntoUsize> { /* private fields */ }Implementations§
Source§impl<I: VectorId + IntoUsize> NeighborProvider<I>
impl<I: VectorId + IntoUsize> NeighborProvider<I>
Sourcepub fn new_with_config(max_degree: u32, config: Config) -> ANNResult<Self>
pub fn new_with_config(max_degree: u32, config: Config) -> ANNResult<Self>
Create a new instance based on bf-tree Config directly.
Sourcepub fn max_degree(&self) -> u32
pub fn max_degree(&self) -> u32
Return the maximum degree (number of neighbors per vector)
Sourcepub fn get_neighbors(
&self,
vector_id: I,
neighbors: &mut AdjacencyList<I>,
) -> ANNResult<()>
pub fn get_neighbors( &self, vector_id: I, neighbors: &mut AdjacencyList<I>, ) -> ANNResult<()>
Retrieve the neighbor list of a vector.
Does not acquire any lock. Callers must ensure appropriate synchronization.
Sourcepub fn set_neighbors(
&self,
vector_id: I,
neighbors: &[I],
buf: &mut [I],
) -> ANNResult<()>
pub fn set_neighbors( &self, vector_id: I, neighbors: &[I], buf: &mut [I], ) -> ANNResult<()>
Insert a neighbor list of a vector in bf-tree as a (K, V) pair.
Does not acquire any lock. Callers must ensure appropriate synchronization.
The list of neighbors and their length is written into the passed buffer
buf before writing the leading self.dim * std::mem::size_of::<I>()
bytes of it into the bf-tree.
§Errors
- Neighbor length is larger than
self.max_degree() - Buffer length (in
Icells) is smaller thanmax_degree() + 1
Sourcepub fn append_vector(
&self,
vector_id: I,
new_neighbor_ids: &[I],
buf: &mut [I],
) -> ANNResult<()>
pub fn append_vector( &self, vector_id: I, new_neighbor_ids: &[I], buf: &mut [I], ) -> ANNResult<()>
Append unique vectors into a neighbor list.
Does not acquire any lock. Callers must ensure appropriate synchronization for the entire read-modify-write cycle.
The newly appended neighbor list will always be extended to ‘dim’ long to avoid frequent mem copy in bf-tree.
Note: assuming all neighbors in the input list, ‘new_neighbor_ids’, are valid
pub fn delete_vector(&self, vector_id: I) -> ANNResult<()>
Trait Implementations§
Auto Trait Implementations§
impl<I> !Freeze for NeighborProvider<I>
impl<I> !RefUnwindSafe for NeighborProvider<I>
impl<I> !UnwindSafe for NeighborProvider<I>
impl<I> Send for NeighborProvider<I>
impl<I> Sync for NeighborProvider<I>
impl<I> Unpin for NeighborProvider<I>where
I: Unpin,
impl<I> UnsafeUnpin for NeighborProvider<I>
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