Skip to main content

WriteBufferManager

Trait WriteBufferManager 

Source
pub trait WriteBufferManager:
    Send
    + Sync
    + Debug {
    // Required methods
    fn should_flush_engine(&self) -> bool;
    fn should_stall(&self) -> bool;
    fn reserve_mem(&self, mem: usize);
    fn schedule_free_mem(&self, mem: usize);
    fn free_mem(&self, mem: usize);
    fn memory_usage(&self) -> usize;
    fn flush_limit(&self) -> usize;
}
Expand description

Global write buffer (memtable) manager.

Tracks write buffer (memtable) usages and decide whether the engine needs to flush.

Required Methods§

Source

fn should_flush_engine(&self) -> bool

Returns whether to trigger the engine.

Source

fn should_stall(&self) -> bool

Returns whether to stall write requests.

Source

fn reserve_mem(&self, mem: usize)

Reserves mem bytes.

Source

fn schedule_free_mem(&self, mem: usize)

Tells the manager we are freeing mem bytes.

We are in the process of freeing mem bytes, so it is not considered when checking the soft limit.

Source

fn free_mem(&self, mem: usize)

We have freed mem bytes.

Source

fn memory_usage(&self) -> usize

Returns the total memory used by memtables.

Source

fn flush_limit(&self) -> usize

Returns the mutable memtable memory limit.

The write buffer manager should flush memtables when the mutable memory usage exceeds this limit.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§