Skip to main content

plan_compaction

Function plan_compaction 

Source
pub fn plan_compaction(
    ops: &[OpRecord],
    acks: &AckTable,
    policy: &RetentionPolicy,
    as_of_ms: Option<u64>,
) -> Result<CompactionPlan, CompactError>
Expand description

Plan a compaction of ops at the AckTable’s stable frontier. Pure — no file IO; compact_and_truncate executes a plan durably. See the module docs for the three safety guards; per-device HLC monotonicity (enforced by verify_log) guarantees “hlc ≤ frontier” is a chain prefix, so the cut is always anchorable.

as_of_ms: the age rules’ reference instant. None (the default every caller should want) derives it deterministically via as_of_from_ops over the below-frontier ops, so identical frontiers yield identical retained checkpoints on every device.