Skip to main content

plan_prune

Function plan_prune 

Source
pub fn plan_prune(dir: &Path, limit: u64) -> PrunePlan
Expand description

The selection prune_dir would act on if every one of these deletions succeeds, computed without touching disk.

Read-only on purpose: a preview must never take the cache’s lease (see cache::maintenance_prune’s doc) — it does not write anything, so it cannot race a build the way a real prune would, and a caller only wanting to show an operator a plan should not have to wait out contention to do it. This is necessarily an idealized selection, not a prediction of every file prune_dir will end up touching: a build finishing between the preview and a real prune can change what gets deleted, and so can a single locked file on the real pass, which - unlike this preview - has to keep reaching past its own plan for another (newer) file when an older one it counted on turns out to be unremovable. The CLI surface that shows this preview says so.