mirror of
https://github.com/sreedevk/deduplicator.git
synced 2026-09-14 01:26:33 +00:00
move max path size update to a later stage in the pipeline for accurate results
This commit is contained in:
@@ -16,6 +16,7 @@ impl Interactive {
|
|||||||
let mut itable = Table::new();
|
let mut itable = Table::new();
|
||||||
itable.set_format(*format::consts::FORMAT_NO_BORDER_LINE_SEPARATOR);
|
itable.set_format(*format::consts::FORMAT_NO_BORDER_LINE_SEPARATOR);
|
||||||
itable.set_titles(row!["index", "filename", "size", "updated_at"]);
|
itable.set_titles(row!["index", "filename", "size", "updated_at"]);
|
||||||
|
|
||||||
let max_path_size = group
|
let max_path_size = group
|
||||||
.iter()
|
.iter()
|
||||||
.map(|f| f.path.iter().count())
|
.map(|f| f.path.iter().count())
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ impl Processor {
|
|||||||
sw_store: Arc<DashMap<u64, Vec<FileInfo>>>,
|
sw_store: Arc<DashMap<u64, Vec<FileInfo>>>,
|
||||||
hw_store: Arc<DashMap<String, Vec<FileInfo>>>,
|
hw_store: Arc<DashMap<String, Vec<FileInfo>>>,
|
||||||
progress_bar_box: Arc<MultiProgress>,
|
progress_bar_box: Arc<MultiProgress>,
|
||||||
|
max_file_size: Arc<AtomicU64>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let progress_bar = match app_args.progress {
|
let progress_bar = match app_args.progress {
|
||||||
true => progress_bar_box.add(ProgressBar::new_spinner()),
|
true => progress_bar_box.add(ProgressBar::new_spinner()),
|
||||||
@@ -48,6 +49,12 @@ impl Processor {
|
|||||||
file.initial_page_hash().expect("hashing file failed.")
|
file.initial_page_hash().expect("hashing file failed.")
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Self::compare_and_update_max_path_len(
|
||||||
|
max_file_size.clone(),
|
||||||
|
file.path.to_string_lossy().len() as u64,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
hw_store
|
hw_store
|
||||||
.entry(fhash)
|
.entry(fhash)
|
||||||
.and_modify(|fileset| fileset.push(file.clone()))
|
.and_modify(|fileset| fileset.push(file.clone()))
|
||||||
@@ -72,7 +79,6 @@ impl Processor {
|
|||||||
scanner_finished: Arc<AtomicBool>,
|
scanner_finished: Arc<AtomicBool>,
|
||||||
store: Arc<DashMap<u64, Vec<FileInfo>>>,
|
store: Arc<DashMap<u64, Vec<FileInfo>>>,
|
||||||
files: Arc<Mutex<Vec<FileInfo>>>,
|
files: Arc<Mutex<Vec<FileInfo>>>,
|
||||||
max_file_size: Arc<AtomicU64>,
|
|
||||||
progress_bar_box: Arc<MultiProgress>,
|
progress_bar_box: Arc<MultiProgress>,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
let progress_bar = match app_args.progress {
|
let progress_bar = match app_args.progress {
|
||||||
@@ -97,10 +103,6 @@ impl Processor {
|
|||||||
match fileopt {
|
match fileopt {
|
||||||
Some(file) => {
|
Some(file) => {
|
||||||
progress_bar.inc(1);
|
progress_bar.inc(1);
|
||||||
Self::compare_and_update_max_path_len(
|
|
||||||
max_file_size.clone(),
|
|
||||||
file.path.to_string_lossy().len() as u64,
|
|
||||||
)?;
|
|
||||||
store
|
store
|
||||||
.entry(file.size)
|
.entry(file.size)
|
||||||
.and_modify(|fileset| fileset.push(file.clone()))
|
.and_modify(|fileset| fileset.push(file.clone()))
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ impl Server {
|
|||||||
sfin_pr_tr_cl,
|
sfin_pr_tr_cl,
|
||||||
store_dupl_sw_for_sw,
|
store_dupl_sw_for_sw,
|
||||||
file_queue_clone_pr,
|
file_queue_clone_pr,
|
||||||
max_file_path_len_clone,
|
|
||||||
progbarbox_pr_clone.clone(),
|
progbarbox_pr_clone.clone(),
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@@ -82,6 +81,7 @@ impl Server {
|
|||||||
store_dupl_sw_for_hw,
|
store_dupl_sw_for_hw,
|
||||||
store_dupl_hw,
|
store_dupl_hw,
|
||||||
progbarbox_pr_clone,
|
progbarbox_pr_clone,
|
||||||
|
max_file_path_len_clone,
|
||||||
)
|
)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user