src/api2/pull.rs: implement delete flag for vanished groups

This commit is contained in:
Dietmar Maurer
2020-01-17 11:24:55 +01:00
parent 11d89239c3
commit 4b4eba0b9e
3 changed files with 68 additions and 5 deletions

View File

@ -6,7 +6,7 @@ use std::sync::{Arc, Mutex};
use failure::*;
use lazy_static::lazy_static;
use super::backup_info::BackupDir;
use super::backup_info::{BackupGroup, BackupDir};
use super::chunk_store::{ChunkStore, GarbageCollectionStatus};
use super::dynamic_index::{DynamicIndexReader, DynamicIndexWriter};
use super::fixed_index::{FixedIndexReader, FixedIndexWriter};
@ -168,6 +168,20 @@ impl DataStore {
Ok(())
}
/// Remove a complete backup group including all snapshots
pub fn remove_backup_group(&self, backup_group: &BackupGroup,
) -> Result<(), io::Error> {
let mut full_path = self.base_path();
full_path.push(backup_group.group_path());
log::info!("removing backup group {:?}", full_path);
std::fs::remove_dir_all(full_path)?;
Ok(())
}
/// Remove a backup directory including all content
pub fn remove_backup_dir(&self, backup_dir: &BackupDir,
) -> Result<(), io::Error> {