pub struct MemTable { /* private fields */ }Expand description
In-memory sorted write buffer backed by BTreeMap.
Implementations§
Source§impl MemTable
impl MemTable
pub fn new(capacity: usize) -> Self
Sourcepub fn insert(
&mut self,
id: VectorId,
vector: Option<Vec<f32>>,
metadata: Option<HashMap<String, Value>>,
seq: u64,
) -> bool
pub fn insert( &mut self, id: VectorId, vector: Option<Vec<f32>>, metadata: Option<HashMap<String, Value>>, seq: u64, ) -> bool
Insert/update. Returns true when full.
Sourcepub fn search(&self, query: &[f32], top_k: usize) -> Vec<SearchResult>
pub fn search(&self, query: &[f32], top_k: usize) -> Vec<SearchResult>
Brute-force nearest-neighbour scan (Euclidean).
Sourcepub fn flush(&mut self, level: usize, fp_rate: f64) -> Segment
pub fn flush(&mut self, level: usize, fp_rate: f64) -> Segment
Flush to an immutable segment, clearing the memtable.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_full(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MemTable
impl RefUnwindSafe for MemTable
impl Send for MemTable
impl Sync for MemTable
impl Unpin for MemTable
impl UnsafeUnpin for MemTable
impl UnwindSafe for MemTable
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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