pub struct CompactionConfig {
pub enabled: bool,
pub interval: Duration,
pub size_threshold_bytes: usize,
pub collections: Vec<String>,
}Expand description
Configuration for periodic Automerge document compaction.
Compaction discards CRDT revision history via fork(), keeping only the
current document state. This bounds memory growth on long-running nodes
at the cost of a full-state sync on the next peer exchange.
Fields§
§enabled: boolEnable automatic background compaction. Default: false.
interval: DurationHow often the compaction sweep runs. Default: 5 minutes. Clamped to a minimum of 10 seconds to prevent busy-looping.
size_threshold_bytes: usizeOnly compact documents larger than this threshold. Default: 64 KiB.
collections: Vec<String>Collections to compact. When empty and compaction is enabled,
auto-derives from SyncModeRegistry (all LatestOnly collections).
Only LatestOnly collections are safe to compact — compacting
FullHistory collections destroys change history needed for delta sync.
Implementations§
Source§impl CompactionConfig
impl CompactionConfig
Sourcepub fn effective_interval(&self) -> Duration
pub fn effective_interval(&self) -> Duration
Returns the effective interval, clamped to at least 10 seconds.
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