pub struct LSMIndex { /* private fields */ }Expand description
Write-optimised vector index using LSM-tree tiered compaction.
Writes go to the MemTable; when full it flushes to level 0. Levels
exceeding merge_threshold segments are compacted into the next level.
Implementations§
Source§impl LSMIndex
impl LSMIndex
pub fn new(config: CompactionConfig) -> Self
Sourcepub fn insert(
&mut self,
id: VectorId,
vector: Vec<f32>,
metadata: Option<HashMap<String, Value>>,
)
pub fn insert( &mut self, id: VectorId, vector: Vec<f32>, metadata: Option<HashMap<String, Value>>, )
Insert a vector. Auto-flushes and compacts as needed.
Sourcepub fn search(&self, query: &[f32], top_k: usize) -> Vec<SearchResult>
pub fn search(&self, query: &[f32], top_k: usize) -> Vec<SearchResult>
Search across memtable and all levels, merging results.
Sourcepub fn auto_compact(&mut self)
pub fn auto_compact(&mut self)
Auto-compact levels exceeding merge_threshold.
pub fn stats(&self) -> LSMStats
pub fn write_amplification(&self) -> f64
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LSMIndex
impl RefUnwindSafe for LSMIndex
impl Send for LSMIndex
impl Sync for LSMIndex
impl Unpin for LSMIndex
impl UnsafeUnpin for LSMIndex
impl UnwindSafe for LSMIndex
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