Add local CAS cleanup policy

This commit is contained in:
Eric Wendland 2026-05-16 21:10:25 +02:00
commit 21920b51b5
10 changed files with 184 additions and 8 deletions

View file

@ -243,6 +243,26 @@ pub fn handle_request(
pinned: false,
})
}
ControlRequest::CasCleanup { dry_run } => {
let cas = LocalCas::new(node.paths.cas_dir());
let mut removed = Vec::new();
let mut retained_pinned = Vec::new();
for blob in cas.list()? {
if store.is_cas_object_pinned(blob.hash.as_str())? {
retained_pinned.push(blob.hash);
continue;
}
if !dry_run && cas.remove(&blob.hash)? {
store.delete_cas_object(blob.hash.as_str())?;
}
removed.push(blob.hash);
}
Ok(ControlResponse::CasCleanup {
removed,
retained_pinned,
dry_run,
})
}
ControlRequest::CasList => {
let cas = LocalCas::new(node.paths.cas_dir());
let blobs = cas