pub struct Memtable { /* private fields */ }Expand description
Memtable - an in-memory sorted write buffer
Provides O(log n) insert, lookup, and delete operations. When the memtable reaches a size threshold, it should be flushed to disk as an SSTable.
Implementations§
Source§impl Memtable
impl Memtable
Sourcepub fn with_sequence(sequence: u64) -> Memtable
pub fn with_sequence(sequence: u64) -> Memtable
Creates a new Memtable with a starting sequence number
Sourcepub fn get(&self, key: &[u8]) -> Option<Option<&[u8]>>
pub fn get(&self, key: &[u8]) -> Option<Option<&[u8]>>
Retrieves a value by key
Returns:
Some(Some(value))if the key exists with a valueSome(None)if the key was deleted (tombstone)Noneif the key is not in the memtable
Sourcepub fn size_bytes(&self) -> u64
pub fn size_bytes(&self) -> u64
Returns the approximate size of the memtable in bytes
Sourcepub fn iter(&self) -> impl Iterator<Item = (&Vec<u8>, &MemtableEntry)>
pub fn iter(&self) -> impl Iterator<Item = (&Vec<u8>, &MemtableEntry)>
Returns an iterator over all entries in sorted order
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 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