src/bin/proxmox-backup-proxy.rs: add simple task scheduler for garbage collection

This commit is contained in:
Dietmar Maurer
2020-05-20 08:59:45 +02:00
parent d6c28ddf84
commit 8545480a31
2 changed files with 187 additions and 0 deletions

View File

@ -397,6 +397,10 @@ impl DataStore {
self.last_gc_status.lock().unwrap().clone()
}
pub fn garbage_collection_running(&self) -> bool {
if let Ok(_) = self.gc_mutex.try_lock() { false } else { true }
}
pub fn garbage_collection(&self, worker: &WorkerTask) -> Result<(), Error> {
if let Ok(ref mut _mutex) = self.gc_mutex.try_lock() {