pub fn prune(
root: &Path,
max_bytes: Option<u64>,
holds_runner: &dyn Fn(&Path) -> bool,
) -> Result<CacheUsage, CacheError>Expand description
Measures root, removes least-recently-used idle namespaces until it fits
under max_bytes, and records the result in USAGE_FILE.
Each chosen namespace is re-checked under LockKind::DependencyCache
and renamed into .trash before anything is deleted, so a launch that
leased it after the measurement keeps it.
ยงErrors
The lock could not be taken or the usage file could not be written. A namespace that cannot be moved or deleted is skipped, not an error.