Skip to main content

Options

Struct Options 

Source
pub struct Options {
    pub memtable_size: usize,
    pub l0_compaction_trigger: usize,
    pub l1_max_bytes: u64,
    pub level_multiplier: u32,
    pub target_file_size: u64,
    pub max_levels: usize,
    pub commit_window: Duration,
}
Expand description

Engine tuning knobs. See each field for the default (matches the phase-2 plan).

New fields may be added in a minor (0.x) release. Construct with Options { memtable_size: ..., ..Default::default() } (or start from Options::default() and mutate individual fields) rather than a full struct literal, so adding a field there isn’t a breaking change for callers.

Fields§

§memtable_size: usize

Freeze the active memtable and roll to a new WAL once its approximate size reaches this.

This also bounds recovery time: replay on reopen never reads more than roughly memtable_size * (1 + MAX_IMMUTABLE_MEMTABLES) bytes of WAL (the active memtable plus however many frozen-but-unflushed ones rotate allows to queue – see MAX_IMMUTABLE_MEMTABLES in db.rs), since anything older has already been flushed to an SST and its WAL deleted. Each memtable can overshoot that budget by at most one request’s bytes (write_batch’s ops are never split across a group-commit boundary), since the writer thread stops draining a group commit once it’s already queued that many bytes – see writer_thread’s budget in db.rs.

Range: >= MIN_MEMTABLE_SIZE (1 KiB). Db::open/open_with rejects anything smaller with Error::InvalidArgument.

§l0_compaction_trigger: usize

Compact all of L0 (+ overlapping L1) once L0 holds at least this many files.

Range: >= 1.

§l1_max_bytes: u64

L1’s byte budget; L_n’s budget is l1_max_bytes * level_multiplier^(n-1).

Range: >= 1.

§level_multiplier: u32

Per-level growth factor for the byte budget above.

Range: >= 1 (1 disables growth: every level above L1 shares L1’s budget).

§target_file_size: u64

Roll to a new output SST once a compaction/flush output reaches this size (only at a user-key boundary).

Range: >= 1.

§max_levels: usize

Number of levels, L0..L(max_levels-1). The bottom level is never a compaction source.

Range: 2..=255 (at least L0 + one bottom level; compaction encodes a level number as u8, so max_levels - 1 must fit in a u8).

§commit_window: Duration

How long the writer thread waits for more writes to batch after draining what’s already queued, once at least one request has arrived. Duration::ZERO disables the wait.

Trait Implementations§

Source§

impl Clone for Options

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Options

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Options

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more