pub struct Memtable { /* private fields */ }Expand description
The memtable serves as an intermediary, ephemeral, sorted storage for new items
When the Memtable exceeds some size, it should be flushed to a table.
Implementations§
Source§impl Memtable
impl Memtable
Sourcepub fn id(&self) -> MemtableId
pub fn id(&self) -> MemtableId
Returns the memtable ID.
Sourcepub fn is_flagged_for_rotation(&self) -> bool
pub fn is_flagged_for_rotation(&self) -> bool
Returns true if the memtable was already flagged for rotation.
Sourcepub fn flag_rotated(&self)
pub fn flag_rotated(&self)
Flags the memtable as requested for rotation.
Sourcepub fn iter(&self) -> impl DoubleEndedIterator<Item = InternalValue> + '_
pub fn iter(&self) -> impl DoubleEndedIterator<Item = InternalValue> + '_
Creates an iterator over all items.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Returns true if the memtable has no KV items and no range tombstones.
Sourcepub fn verify_kv_residence(&self) -> Result<()>
pub fn verify_kv_residence(&self) -> Result<()>
Verifies every insert-time per-KV digest in this memtable against a
recompute over the entry’s current bytes (the
KvChecksumComputePoint::AtInsert
residence check), called once at flush.
Returns Ok immediately when no AtInsert digest was ever inserted, so
the default path pays nothing.
§Errors
crate::Error::MemtableKvChecksumMismatchwhen an entry’s stored digest diverges from the recompute (a RAM bit-flip during residence).crate::Error::FeatureUnsupportedwhen a node’s algorithm is not compiled into this build.
Sourcepub fn insert_range_tombstone(
&self,
start: UserKey,
end: UserKey,
seqno: SeqNo,
) -> u64
pub fn insert_range_tombstone( &self, start: UserKey, end: UserKey, seqno: SeqNo, ) -> u64
Inserts a range tombstone covering [start, end) at the given seqno.
Returns the approximate size added to the memtable.
Returns 0 if start >= end or if either bound exceeds u16::MAX bytes.
§Panics
Panics if the internal RwLock is poisoned.
Sourcepub fn range_tombstone_count(&self) -> usize
pub fn range_tombstone_count(&self) -> usize
Returns the number of range tombstones.
Sourcepub fn get_highest_seqno(&self) -> Option<SeqNo>
pub fn get_highest_seqno(&self) -> Option<SeqNo>
Returns the highest sequence number in the memtable.
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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>
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>
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