pub struct ChronixConfigBuilder { /* private fields */ }Expand description
Builder for ChronixConfig with validation on build().
Implementations§
Source§impl ChronixConfigBuilder
impl ChronixConfigBuilder
Sourcepub fn data_dir(self, path: impl Into<PathBuf>) -> Self
pub fn data_dir(self, path: impl Into<PathBuf>) -> Self
Set the data directory path (required).
Sourcepub fn wal_fsync_policy(self, policy: FsyncPolicy) -> Self
pub fn wal_fsync_policy(self, policy: FsyncPolicy) -> Self
Set the WAL fsync policy.
Sourcepub fn wal_max_file_size(self, size: usize) -> Self
pub fn wal_max_file_size(self, size: usize) -> Self
Set the maximum WAL file size.
Sourcepub fn wal_max_unflushed(self, count: usize) -> Self
pub fn wal_max_unflushed(self, count: usize) -> Self
Set the maximum number of unflushed WAL files.
Sourcepub fn memtable_flush_threshold(self, size: usize) -> Self
pub fn memtable_flush_threshold(self, size: usize) -> Self
Set the memtable flush threshold in bytes.
Sourcepub fn max_memtable_memory(self, size: usize) -> Self
pub fn max_memtable_memory(self, size: usize) -> Self
Set the maximum total memtable memory.
Sourcepub fn shard_duration(self, duration: Duration) -> Self
pub fn shard_duration(self, duration: Duration) -> Self
Set the time-shard duration.
Sourcepub fn retention(self, duration: Option<Duration>) -> Self
pub fn retention(self, duration: Option<Duration>) -> Self
Set the retention period (None for infinite).
Sourcepub fn compression(self, codec: CompressionCodec) -> Self
pub fn compression(self, codec: CompressionCodec) -> Self
Set the compression codec.
Sourcepub fn zstd_level(self, level: i32) -> Self
pub fn zstd_level(self, level: i32) -> Self
Set the Zstd compression level for new segments (1–22).
Sourcepub fn zstd_dict_training(self, enabled: bool) -> Self
pub fn zstd_dict_training(self, enabled: bool) -> Self
Enable Zstd dictionary training for new segments.
Sourcepub fn float_encoding(self, encoding: FloatEncoding) -> Self
pub fn float_encoding(self, encoding: FloatEncoding) -> Self
Set the float encoding algorithm.
Sourcepub fn ooo_shard_tolerance(self, tolerance: u32) -> Self
pub fn ooo_shard_tolerance(self, tolerance: u32) -> Self
Set the out-of-order shard tolerance (in shard units).
Sourcepub fn measurement_retention(
self,
measurement: impl Into<String>,
duration: Duration,
) -> Self
pub fn measurement_retention( self, measurement: impl Into<String>, duration: Duration, ) -> Self
Add a per-measurement retention override.
Sourcepub fn compaction_concurrency(self, concurrency: usize) -> Self
pub fn compaction_concurrency(self, concurrency: usize) -> Self
Set the maximum concurrent compaction tasks.
Sourcepub fn field_encryption(self, settings: FieldEncryption) -> Self
pub fn field_encryption(self, settings: FieldEncryption) -> Self
Declare which columns are encrypted and where their keys live.
See FieldEncryption. The declaration is checked at
build; the keys themselves are resolved from the
environment when the database is opened, so a missing variable is a
startup error rather than a column that silently writes plaintext.
Sourcepub fn checkpoints(self, settings: Checkpoints) -> Self
pub fn checkpoints(self, settings: Checkpoints) -> Self
Take a checkpoint on a schedule — see Checkpoints.
Sourcepub fn maintenance_interval(self, interval: Duration) -> Self
pub fn maintenance_interval(self, interval: Duration) -> Self
Set how often the built-in maintenance thread compacts, materialises
rollups and enforces retention. Duration::ZERO disables the
periodic passes.
Sourcepub fn enable_last_value_cache(self, enable: bool) -> Self
pub fn enable_last_value_cache(self, enable: bool) -> Self
Enable or disable the Last Value Cache.
Sourcepub fn lvc_measurements(self, measurements: HashSet<String>) -> Self
pub fn lvc_measurements(self, measurements: HashSet<String>) -> Self
Restrict the Last Value Cache to specific measurements.
When set, only the listed measurements participate in the LVC.
Requires enable_last_value_cache(true) to have any effect.
Sourcepub fn cdc_capacity(self, events: usize) -> Self
pub fn cdc_capacity(self, events: usize) -> Self
CDC event-bus capacity, in events.
The ring is allocated on the first subscription; a deployment that never reads the CDC stream pays nothing for this.
Sourcepub fn segment_cache_size(self, size: usize) -> Self
pub fn segment_cache_size(self, size: usize) -> Self
Set the segment cache size in bytes.
Sourcepub fn max_series_cardinality(self, max: usize) -> Self
pub fn max_series_cardinality(self, max: usize) -> Self
Set the maximum series cardinality per shard.
Sourcepub fn max_query_result_bytes(self, max: usize) -> Self
pub fn max_query_result_bytes(self, max: usize) -> Self
Set the maximum query result size in bytes (0 = unlimited).
Sourcepub fn per_query_memory_limit(self, limit: usize) -> Self
pub fn per_query_memory_limit(self, limit: usize) -> Self
Set the per-query memory budget in bytes (0 = unlimited).
Sourcepub fn query_timeout(self, timeout: Duration) -> Self
pub fn query_timeout(self, timeout: Duration) -> Self
Set the query execution timeout (Duration::ZERO = no timeout).
Sourcepub fn analytics(self, config: AnalyticsConfig) -> Self
pub fn analytics(self, config: AnalyticsConfig) -> Self
Set the analytics engine configuration.
Sourcepub fn soft_delete_ttl(self, ttl: Option<Duration>) -> Self
pub fn soft_delete_ttl(self, ttl: Option<Duration>) -> Self
Set the soft-delete TTL for dropped measurements.
When set, drop_measurement marks the measurement as pending
deletion instead of immediately removing data.
Sourcepub fn future_write_tolerance(self, tolerance: Duration) -> Self
pub fn future_write_tolerance(self, tolerance: Duration) -> Self
Set how far ahead of the wall clock a timestamp may be (default: 1 h).
Sourcepub fn build(self) -> Result<ChronixConfig, ConfigError>
pub fn build(self) -> Result<ChronixConfig, ConfigError>
Build the configuration, validating all constraints.
§Errors
Returns ConfigError if a required field is missing or a constraint
is violated.
Trait Implementations§
Source§impl Clone for ChronixConfigBuilder
impl Clone for ChronixConfigBuilder
Source§fn clone(&self) -> ChronixConfigBuilder
fn clone(&self) -> ChronixConfigBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more