pub struct StreamBuffer { /* private fields */ }Expand description
A buffer for streaming vector updates.
§Design
The buffer maintains:
- Insert buffer: New vectors not yet in main index
- Delete set: IDs marked for deletion (applied during compaction)
During search, both buffer and main index are queried, with delete set filtering applied to results.
Implementations§
Source§impl StreamBuffer
impl StreamBuffer
pub fn new() -> Self
pub fn with_config(config: StreamBufferConfig) -> Self
Sourcepub fn insert(&mut self, id: u32, vector: Vec<f32>) -> Result<()>
pub fn insert(&mut self, id: u32, vector: Vec<f32>) -> Result<()>
Insert a vector into the buffer.
Sourcepub fn needs_compaction(&self) -> bool
pub fn needs_compaction(&self) -> bool
Check if buffer needs compaction.
Sourcepub fn drain(&mut self) -> (HashMap<u32, Vec<f32>>, HashSet<u32>)
pub fn drain(&mut self) -> (HashMap<u32, Vec<f32>>, HashSet<u32>)
Drain the buffer for compaction.
Sourcepub fn insert_count(&self) -> usize
pub fn insert_count(&self) -> usize
Number of buffered inserts.
Sourcepub fn delete_count(&self) -> usize
pub fn delete_count(&self) -> usize
Number of pending deletes.
Sourcepub fn is_deleted(&self, id: u32) -> bool
pub fn is_deleted(&self, id: u32) -> bool
Check if an ID is pending delete.
Trait Implementations§
Source§impl Debug for StreamBuffer
impl Debug for StreamBuffer
Auto Trait Implementations§
impl Freeze for StreamBuffer
impl RefUnwindSafe for StreamBuffer
impl Send for StreamBuffer
impl Sync for StreamBuffer
impl Unpin for StreamBuffer
impl UnsafeUnpin for StreamBuffer
impl UnwindSafe for StreamBuffer
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