verify: avoid generics and use &dyn Fn() for filter

This commit is contained in:
Dietmar Maurer 2020-10-28 13:19:21 +01:00
parent a4915dfc2b
commit 328df3b507
1 changed files with 4 additions and 4 deletions

View File

@ -404,7 +404,7 @@ pub fn verify_backup_dir_with_lock(
/// Returns /// Returns
/// - Ok((count, failed_dirs)) where failed_dirs had verification errors /// - Ok((count, failed_dirs)) where failed_dirs had verification errors
/// - Err(_) if task was aborted /// - Err(_) if task was aborted
pub fn verify_backup_group<F: Fn(&BackupInfo) -> bool>( pub fn verify_backup_group(
datastore: Arc<DataStore>, datastore: Arc<DataStore>,
group: &BackupGroup, group: &BackupGroup,
verified_chunks: Arc<Mutex<HashSet<[u8;32]>>>, verified_chunks: Arc<Mutex<HashSet<[u8;32]>>>,
@ -412,7 +412,7 @@ pub fn verify_backup_group<F: Fn(&BackupInfo) -> bool>(
progress: Option<(usize, usize)>, // (done, snapshot_count) progress: Option<(usize, usize)>, // (done, snapshot_count)
worker: Arc<dyn TaskState + Send + Sync>, worker: Arc<dyn TaskState + Send + Sync>,
upid: &UPID, upid: &UPID,
filter: &F, filter: &dyn Fn(&BackupInfo) -> bool,
) -> Result<(usize, Vec<String>), Error> { ) -> Result<(usize, Vec<String>), Error> {
let mut errors = Vec::new(); let mut errors = Vec::new();
@ -482,11 +482,11 @@ pub fn verify_backup_group<F: Fn(&BackupInfo) -> bool>(
/// Returns /// Returns
/// - Ok(failed_dirs) where failed_dirs had verification errors /// - Ok(failed_dirs) where failed_dirs had verification errors
/// - Err(_) if task was aborted /// - Err(_) if task was aborted
pub fn verify_all_backups<F: Fn(&BackupInfo) -> bool>( pub fn verify_all_backups(
datastore: Arc<DataStore>, datastore: Arc<DataStore>,
worker: Arc<dyn TaskState + Send + Sync>, worker: Arc<dyn TaskState + Send + Sync>,
upid: &UPID, upid: &UPID,
filter: &F, filter: &dyn Fn(&BackupInfo) -> bool,
) -> Result<Vec<String>, Error> { ) -> Result<Vec<String>, Error> {
let mut errors = Vec::new(); let mut errors = Vec::new();