Struct raft_engine::Config
source · pub struct Config {Show 17 fields
pub dir: String,
pub spill_dir: Option<String>,
pub recovery_mode: RecoveryMode,
pub recovery_read_block_size: ReadableSize,
pub recovery_threads: usize,
pub batch_compression_threshold: ReadableSize,
pub compression_level: Option<usize>,
pub bytes_per_sync: Option<ReadableSize>,
pub format_version: Version,
pub target_file_size: ReadableSize,
pub purge_threshold: ReadableSize,
pub purge_rewrite_threshold: Option<ReadableSize>,
pub purge_rewrite_garbage_ratio: f64,
pub memory_limit: Option<ReadableSize>,
pub enable_log_recycle: bool,
pub prefill_for_recycle: bool,
pub prefill_limit: Option<ReadableSize>,
}Fields§
§dir: StringMain directory to store log files. Will create on startup if not exists.
Default: “”
spill_dir: Option<String>Auxiliary directory to store log files. Will create on startup if set but not exists.
Newly logs will be put into this dir when the main dir is full
and no spare space for new logs.
Default: None
recovery_mode: RecoveryModeHow to deal with file corruption during recovery.
Default: “tolerate-tail-corruption”.
recovery_read_block_size: ReadableSizeMinimum I/O size for reading log files during recovery.
Default: “16KB”. Minimum: “512B”.
recovery_threads: usizeThe number of threads used to scan and recovery log files.
Default: 4. Minimum: 1.
batch_compression_threshold: ReadableSizeCompress a log batch if its size exceeds this value. Setting it to zero disables compression.
Default: “8KB”
compression_level: Option<usize>Acceleration factor for LZ4 compression. It can be fine tuned, with each successive value providing roughly +~3% to speed. The value will be capped within [1, 65537] by LZ4.
Default: 1.
bytes_per_sync: Option<ReadableSize>Deprecated. Incrementally sync log files after specified bytes have been written. Setting it to zero disables incremental sync.
Default: “4MB”
format_version: VersionVersion of the log file.
Default: 2
target_file_size: ReadableSizeTarget file size for rotating log files.
Default: “128MB”
purge_threshold: ReadableSizePurge append log queue if its size exceeds this value.
Default: “10GB”
purge_rewrite_threshold: Option<ReadableSize>Purge rewrite log queue if its size exceeds this value.
Default: MAX(purge_threshold / 10, target_file_size)
purge_rewrite_garbage_ratio: f64Purge rewrite log queue if its garbage ratio exceeds this value.
Default: “0.6”
memory_limit: Option<ReadableSize>Maximum memory bytes allowed for the in-memory index.
Effective under the swap feature only.
Default: None
enable_log_recycle: boolWhether to recycle stale log files.
If true, logically purged log files will be reserved for recycling.
Only available for format_version 2 and above.
Default: true
prefill_for_recycle: boolWhether to prepare log files for recycling when start.
If true, batch empty log files will be prepared for recycling when
starting engine.
Only available for enable-log-reycle is true.
Default: false
prefill_limit: Option<ReadableSize>Maximum capacity for preparing log files for recycling when start.
If not None, its size is equal to purge-threshold.
Only available for prefill-for-recycle is true.
Default: None