Struct grebedb::Options[][src]

pub struct Options {
    pub open_mode: OpenMode,
    pub keys_per_node: usize,
    pub page_cache_size: usize,
    pub file_locking: bool,
    pub file_sync: SyncOption,
    pub automatic_flush: bool,
    pub automatic_flush_threshold: usize,
    pub compression_level: CompressionLevel,
}
Expand description

Database configuration options.

Fields

open_mode: OpenMode

Option when opening a database. Default: LoadOrCreate.

keys_per_node: usize

Maximum number of keys-value pairs per node. Default: 1024.

This value specifies the threshold when a tree node is considered full. When a node is full, it is split into two and the tree is rebalanced.

A page contains a single node and a page is stored on disk as one file.

This option shouldn’t be changed without making performance and resource usage benchmarks.

page_cache_size: usize

Maximum number of pages held in memory cache. Default: 64.

The cache is used to store frequently accessed pages for reducing disk operations.

If memory usage is too high, consider decreasing this value first.

file_locking: bool

Whether to use file locking to prevent corruption by multiple processes. Default: true.

file_sync: SyncOption

Level of file synchronization to increase durability on disk file systems. Default: Data

automatic_flush: bool

Whether to flush the data to the file system periodically when a database operation is performed. Default: true.

When true, data is flushed when the database is dropped or when enough modifications accumulate. Setting this option to false allows you to manually persist changes at more optimal points.

There is no background maintenance thread that does automatic flushing; automatic flushing occurs when a database modifying function, such as put() or remove(), is called.

automatic_flush_threshold: usize

Number of modifications required for automatic flush to be considered. Default: 2048

When the threshold is reached after 300 seconds, or the threshold × 2 is reached after 60 seconds, a flush is scheduled to be performed on the next modification.

compression_level: CompressionLevel

Compression level for each page. Default: Low.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.