Add local CAS cleanup policy
This commit is contained in:
parent
00471bcec0
commit
21920b51b5
10 changed files with 184 additions and 8 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue