pub struct CompactionConfig {
pub min_files_to_compact: usize,
pub target_file_size: usize,
pub max_file_size: usize,
pub small_file_threshold: usize,
pub compaction_interval_seconds: u64,
pub auto_compact: bool,
pub strategy: CompactionStrategy,
pub retention: RetentionConfig,
pub archive: Option<Arc<dyn ArchiveTarget>>,
}Fields§
§min_files_to_compact: usizeMinimum number of files to trigger compaction
target_file_size: usizeTarget size for compacted files (in bytes)
max_file_size: usizeMaximum size for a single compacted file (in bytes)
small_file_threshold: usizeMinimum file size to consider for compaction (small files)
compaction_interval_seconds: u64Time interval between automatic compactions (in seconds)
auto_compact: boolEnable automatic background compaction
strategy: CompactionStrategyCompaction strategy
retention: RetentionConfigPer-tenant retention TTLs (Step 5 of the sustainable data
strategy). Applied during the same compaction pass — events
older than now - ttl for that tenant are dropped from the
snapshot output and the originals are removed. Default
honors the bead: tenant system keeps 30 days; everyone
else keeps forever.
archive: Option<Arc<dyn ArchiveTarget>>Optional cold-tier archive. When set, events that would be
dropped by retention are archived to this target BEFORE the
originals are deleted. A failed archive aborts the
compaction pass — originals stay on disk and the next run
retries. Default None preserves the pre-cold-tier behavior:
retention deletes outright. See
infrastructure::persistence::cold_tier.
Implementations§
Source§impl CompactionConfig
impl CompactionConfig
Sourcepub fn from_env() -> Self
pub fn from_env() -> Self
Build a config from the relevant env vars:
ALLSOURCE_SNAPSHOT_INTERVAL_SECONDS: per-pass cadence (default 3600).ALLSOURCE_RETENTION_SYSTEM_DAYS: TTL for thesystemtenant in days (default 30).
Unparseable values log a warning and fall back to defaults — boot doesn’t fail.
Sourcepub fn from_env_vars(
interval_var: Option<String>,
system_retention_days_var: Option<String>,
) -> Self
pub fn from_env_vars( interval_var: Option<String>, system_retention_days_var: Option<String>, ) -> Self
Testable variant of from_env. Production calls from_env;
tests pass explicit values.
Sourcepub fn from_env_var(interval_var: Option<String>) -> Self
pub fn from_env_var(interval_var: Option<String>) -> Self
Backwards-compatible single-arg variant for existing callers that only set the snapshot interval.
Trait Implementations§
Source§impl Clone for CompactionConfig
impl Clone for CompactionConfig
Source§fn clone(&self) -> CompactionConfig
fn clone(&self) -> CompactionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more