pub struct WriteEngineConfig {
pub data_dir: PathBuf,
pub wal_dir: PathBuf,
pub memtable_flush_threshold: usize,
pub memtable_hard_limit: usize,
pub schema: TableSchema,
pub durability: Durability,
pub udt_registry: Option<UdtRegistry>,
pub auto_compaction: bool,
pub compaction_min_threshold: usize,
pub compaction_max_threshold: usize,
}Expand description
Write engine configuration
Fields§
§data_dir: PathBufDirectory for SSTable data files
wal_dir: PathBufDirectory for WAL files
memtable_flush_threshold: usizeMemtable flush threshold in bytes (default: 64MB)
memtable_hard_limit: usizeMemtable hard limit in bytes (default: 256MB) When this limit is reached, writes will fail with an error
schema: TableSchemaTable schema for column metadata
durability: DurabilityWAL durability mode (default: Durability::SyncEachWrite)
udt_registry: Option<UdtRegistry>Optional UDT registry for resolving bare CQL UDT column types to their
UserType(...) marshal form at flush time (issue #929). When None
(the default), a column whose data_type is a bare UDT name is written
as a single simple cell (documented fallback).
auto_compaction: boolWhether the engine installs a default STCS compaction policy so that
WriteEngine::maintenance_step performs size-tiered compaction
(issue #1619). Defaults to true (compaction on). Set to false to
disable compaction entirely — maintenance_step then becomes a no-op.
compaction_min_threshold: usizeMinimum number of SSTables in a size bucket required to trigger a
compaction (STCS min_threshold). Defaults to 4. Ignored when
WriteEngineConfig::auto_compaction is false.
compaction_max_threshold: usizeMaximum number of SSTables compacted together in one step (STCS
max_threshold). Defaults to 32. Ignored when
WriteEngineConfig::auto_compaction is false.
Implementations§
Source§impl WriteEngineConfig
impl WriteEngineConfig
Sourcepub const DEFAULT_FLUSH_THRESHOLD: usize
pub const DEFAULT_FLUSH_THRESHOLD: usize
Default flush threshold (64 MB)
Sourcepub const DEFAULT_HARD_LIMIT: usize
pub const DEFAULT_HARD_LIMIT: usize
Default hard limit (256 MB)
Sourcepub const DEFAULT_COMPACTION_MIN_THRESHOLD: usize = 4
pub const DEFAULT_COMPACTION_MIN_THRESHOLD: usize = 4
Default STCS min_threshold (issue #1619)
Sourcepub const DEFAULT_COMPACTION_MAX_THRESHOLD: usize = 32
pub const DEFAULT_COMPACTION_MAX_THRESHOLD: usize = 32
Default STCS max_threshold (issue #1619)
Sourcepub fn new(data_dir: PathBuf, wal_dir: PathBuf, schema: TableSchema) -> Self
pub fn new(data_dir: PathBuf, wal_dir: PathBuf, schema: TableSchema) -> Self
Create a new configuration with default flush threshold
Sourcepub fn with_udt_registry(self, registry: UdtRegistry) -> Self
pub fn with_udt_registry(self, registry: UdtRegistry) -> Self
Attach a UdtRegistry used to resolve bare CQL UDT column types at
flush time (issue #929). See WriteEngineConfig::udt_registry.
Sourcepub fn with_flush_threshold(self, threshold: usize) -> Self
pub fn with_flush_threshold(self, threshold: usize) -> Self
Set a custom flush threshold
Sourcepub fn with_hard_limit(self, limit: usize) -> Self
pub fn with_hard_limit(self, limit: usize) -> Self
Set a custom hard limit
Sourcepub fn with_durability(self, durability: Durability) -> Self
pub fn with_durability(self, durability: Durability) -> Self
Set the WAL durability mode.
Mirrors with_flush_threshold in style. See Durability for the
trade-offs between Durability::SyncEachWrite (default, production)
and Durability::Disabled (bulk-load / benchmarking).
§Example
use cqlite_core::storage::write_engine::{Durability, WriteEngineConfig};
let config = WriteEngineConfig::new(data, wal, schema)
.with_durability(Durability::Disabled);Sourcepub fn with_compaction_config(self, compaction: &CompactionConfig) -> Self
pub fn with_compaction_config(self, compaction: &CompactionConfig) -> Self
Apply a crate::config::CompactionConfig onto this write-engine
configuration (issue #1619). This makes Config.storage.compaction
authoritative for the write path: auto_compaction = false disables the
default STCS policy so WriteEngine::maintenance_step becomes a no-op.
The compaction thresholds (compaction_min_threshold /
compaction_max_threshold) keep their defaults; only the on/off switch
is surfaced through the public Config today.
Trait Implementations§
Source§impl Clone for WriteEngineConfig
impl Clone for WriteEngineConfig
Source§fn clone(&self) -> WriteEngineConfig
fn clone(&self) -> WriteEngineConfig
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more