Skip to content

Commit aabc628

Browse files
Add item size to Complete callback
1 parent ffd97d8 commit aabc628

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/bin/ffbuildtool.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ impl ProgressManager {
136136
ItemProgress::Validating => {
137137
self.update_item_validating(name);
138138
}
139-
ItemProgress::Completed | ItemProgress::Failed => {
139+
ItemProgress::Completed(_) | ItemProgress::Failed => {
140140
self.finish_item(name);
141141
}
142142
}

src/lib.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ mod tests;
2727
pub enum ItemProgress {
2828
Downloading(u64, u64), // bytes downloaded, total bytes
2929
Validating,
30-
Completed,
30+
Completed(u64), // total bytes
3131
Failed,
3232
}
3333
pub type ProgressCallback = fn(&Uuid, &str, ItemProgress); // uuid, item name, progress
@@ -462,7 +462,11 @@ impl BundleInfo {
462462

463463
if let Some(cb) = callback {
464464
let uuid = version_uuid.unwrap_or_default();
465-
cb(&uuid, file_name, ItemProgress::Completed);
465+
cb(
466+
&uuid,
467+
file_name,
468+
ItemProgress::Completed(self.compressed_info.size),
469+
);
466470
}
467471
Ok(attempts > 0)
468472
}
@@ -485,7 +489,7 @@ impl BundleInfo {
485489
cb(&uuid, &file_id, ItemProgress::Validating);
486490
}
487491

488-
let mut result = ItemProgress::Completed;
492+
let mut result = ItemProgress::Completed(file_info_good.size);
489493
if let Err(e) = file_info.validate(file_info_good) {
490494
warn!("{} invalid: {}", file_id, e);
491495
corrupted.push((file_id.clone(), e));

0 commit comments

Comments
 (0)