From bd5e18bc9f36fd915dac5c5ab31f9d1695e5155f Mon Sep 17 00:00:00 2001 From: Olivier Date: Fri, 8 Jul 2022 15:17:51 +0100 Subject: [PATCH] Extract load_labelling_rules --- datman/src/commands/backup.rs | 12 +++++++----- datman/src/remote/backup_source_requester.rs | 4 +++- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/datman/src/commands/backup.rs b/datman/src/commands/backup.rs index ecd8855..1d5fbe7 100644 --- a/datman/src/commands/backup.rs +++ b/datman/src/commands/backup.rs @@ -17,7 +17,9 @@ along with Yama. If not, see . use crate::descriptor::{Descriptor, DestPileDescriptor, SourceDescriptor, VirtualSourceKind}; use crate::get_hostname; -use crate::labelling::{label_node, load_labelling_rules, str_to_label, Label, State}; +use crate::labelling::{ + label_node, load_labelling_rules, str_to_label, Label, LabellingRules, State, +}; use crate::tree::{scan, FileTree, FileTree1}; use anyhow::{anyhow, bail}; use arc_interner::ArcIntern; @@ -76,8 +78,8 @@ pub fn open_stdout_backup_process( pub fn label_filter_and_convert( tree: FileTree1<()>, descriptor: &Descriptor, - desc_path: &Path, source_name: &str, + rules: &LabellingRules, dest: &DestPileDescriptor, ) -> anyhow::Result> { info!("Labelling."); @@ -87,8 +89,7 @@ pub fn label_filter_and_convert( .iter() .map(|l| Label(ArcIntern::new(l.clone()))) .collect(); - let rules = load_labelling_rules(desc_path, source_name)?; - label_node("".to_owned(), None, &mut tree, &labels, &rules)?; + label_node("".to_owned(), None, &mut tree, &labels, rules)?; let included_labels: HashSet