feat: 0.5.0 新增子目录增量校验功能

- 当子目录存在 meta.json 时,直接进行 xxh128 快速校验而非重新计算
- 添加详细的错误提示(校验失败/新增文件/文件缺失)
- ProgressTracker 添加 multi() 方法,支持 MultiProgress::suspend 协同输出
- 优化排序:sort_by → sort_unstable_by_key
- 版本号更新至 0.5.0
This commit is contained in:
2026-04-03 21:22:12 +08:00
parent 650e92ad5f
commit d7da1c325f
4 changed files with 66 additions and 11 deletions

View File

@@ -8,9 +8,7 @@ use crate::utils::friendly_size;
/// 进度跟踪器,封装进度条和 IO 统计信息
pub struct ProgressTracker {
// MultiProgress 必须保持存活,否则进度条会消失
#[allow(dead_code)]
_multi: Option<MultiProgress>,
multi: Option<MultiProgress>,
file_progress_bar: Option<ProgressBar>, // 文件数量进度条
current_file_bar: Option<ProgressBar>, // 当前文件进度条
bytes_read: Arc<AtomicU64>,
@@ -54,7 +52,7 @@ impl ProgressTracker {
};
Self {
_multi: multi,
multi,
file_progress_bar,
current_file_bar,
bytes_read: Arc::new(AtomicU64::new(0)),
@@ -82,7 +80,7 @@ impl ProgressTracker {
current_pb.set_message(format!("处理: {}", file_name));
Self {
_multi: Some(multi),
multi: Some(multi),
file_progress_bar: None,
current_file_bar: Some(current_pb),
bytes_read: Arc::new(AtomicU64::new(0)),
@@ -265,4 +263,9 @@ impl ProgressTracker {
iops.fetch_add(1, Ordering::Relaxed);
}
}
/// 获取 MultiProgress用于 `println` / `suspend` 等与进度条协同输出
pub fn multi(&self) -> Option<&MultiProgress> {
self.multi.as_ref()
}
}