pub struct Config {
pub dir: String,
pub read_buffer_size: Option<usize>,
pub chunk_max_records: Option<usize>,
pub chunk_max_size: Option<usize>,
pub truncate_incomplete_record: Option<bool>,
pub flush_batch_wait: Option<Duration>,
pub flush_batch_max_items: Option<usize>,
}Expand description
Configuration for chunked WAL.
This struct holds directory, chunk, recovery, and flush batching settings.
Optional parameters are Option<T> in this struct, and default values is
evaluated when a getter method is called.
Fields§
§dir: StringBase directory for storing WAL files.
read_buffer_size: Option<usize>Size of the read buffer in bytes.
chunk_max_records: Option<usize>Maximum number of records in a chunk.
chunk_max_size: Option<usize>Maximum size of a chunk in bytes.
truncate_incomplete_record: Option<bool>Whether to truncate the last half sync-ed record.
If truncate, the chunk is considered successfully opened. Otherwise, an io::Error will be returned.
flush_batch_wait: Option<Duration>Maximum time the flush worker waits for more write requests before starting a sync batch.
Defaults to 1 millisecond.
flush_batch_max_items: Option<usize>Maximum number of write requests to include in one flush batch.
Defaults to 2048. Values smaller than 1 are treated as 1.
Implementations§
Source§impl Config
impl Config
Sourcepub fn new(dir: impl ToString) -> Self
pub fn new(dir: impl ToString) -> Self
Creates a new Config with the specified directory and defaults.
Sourcepub fn new_full(
dir: impl ToString,
read_buffer_size: Option<usize>,
chunk_max_records: Option<usize>,
chunk_max_size: Option<usize>,
) -> Self
pub fn new_full( dir: impl ToString, read_buffer_size: Option<usize>, chunk_max_records: Option<usize>, chunk_max_size: Option<usize>, ) -> Self
Creates a new Config with all configurable parameters
Sourcepub fn read_buffer_size(&self) -> usize
pub fn read_buffer_size(&self) -> usize
Returns the size of read buffer in bytes (defaults to 64MB)
Sourcepub fn chunk_max_records(&self) -> usize
pub fn chunk_max_records(&self) -> usize
Returns the maximum number of records per chunk (defaults to 1M records)
Sourcepub fn chunk_max_size(&self) -> usize
pub fn chunk_max_size(&self) -> usize
Returns the maximum size of a chunk in bytes (defaults to 1GB)
Sourcepub fn truncate_incomplete_record(&self) -> bool
pub fn truncate_incomplete_record(&self) -> bool
Returns whether to truncate incomplete records (defaults to true)
Sourcepub fn flush_batch_wait(&self) -> Duration
pub fn flush_batch_wait(&self) -> Duration
Returns the bounded wait before syncing a flush batch.
Sourcepub fn flush_batch_max_items(&self) -> usize
pub fn flush_batch_max_items(&self) -> usize
Returns the maximum number of write requests in one flush batch.
Sourcepub fn chunk_path(&self, chunk_id: ChunkId) -> String
pub fn chunk_path(&self, chunk_id: ChunkId) -> String
Returns the full path for a given chunk ID
Sourcepub fn chunk_file_name(chunk_id: ChunkId) -> String
pub fn chunk_file_name(chunk_id: ChunkId) -> String
Generates the file name for a given chunk ID
The file name format is “r-{padded_chunk_id}.wal”