pub struct StagingBuffer { /* private fields */ }Expand description
Staging buffer with pending vectors awaiting HNSW insertion.
Implementations§
Source§impl StagingBuffer
impl StagingBuffer
pub fn new() -> Self
Sourcepub fn add(&mut self, external_id: usize, vector: Vec<f32>) -> bool
pub fn add(&mut self, external_id: usize, vector: Vec<f32>) -> bool
Add a vector to the staging buffer. Returns true if auto-flush is needed.
Sourcepub fn pending_count(&self) -> usize
pub fn pending_count(&self) -> usize
Number of pending vectors.
Sourcepub fn search_merged(
&self,
live: &HnswIndex,
query: &[f32],
k: usize,
ef: usize,
metric: DistanceMetric,
) -> Vec<(usize, f32)>
pub fn search_merged( &self, live: &HnswIndex, query: &[f32], k: usize, ef: usize, metric: DistanceMetric, ) -> Vec<(usize, f32)>
Search both the live HNSW index and the pending buffer, merging results.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for StagingBuffer
impl RefUnwindSafe for StagingBuffer
impl Send for StagingBuffer
impl Sync for StagingBuffer
impl Unpin for StagingBuffer
impl UnsafeUnpin for StagingBuffer
impl UnwindSafe for StagingBuffer
Blanket Implementations§
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
Mutably borrows from an owned value. Read more