Skip to main content

Memtable

Struct Memtable 

Source
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

Source

pub fn id(&self) -> MemtableId

Returns the memtable ID.

Source

pub fn is_flagged_for_rotation(&self) -> bool

Returns true if the memtable was already flagged for rotation.

Source

pub fn flag_rotated(&self)

Flags the memtable as requested for rotation.

Source

pub fn iter(&self) -> impl DoubleEndedIterator<Item = InternalValue> + '_

Creates an iterator over all items.

Source

pub fn size(&self) -> u64

Gets approximate size of memtable in bytes.

Source

pub fn len(&self) -> usize

Counts the number of items in the memtable.

Source

pub fn is_empty(&self) -> bool

Returns true if the memtable has no KV items and no range tombstones.

Source

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.

Source

pub fn range_tombstone_count(&self) -> usize

Returns the number of range tombstones.

§Panics

Panics if the internal RwLock is poisoned.

Source

pub fn get_highest_seqno(&self) -> Option<SeqNo>

Returns the highest sequence number in the memtable.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.