Implement VFS Deduplication (block-level)
Some checks failed
Test / test (push) Has been cancelled
Test / build (push) Has been cancelled

- Add DedupStore with content-addressable storage:
  - SHA-256 hash-based block storage
  - Reference counting for block lifecycle
  - dedup_file() and restore_file() operations
  - DedupManifest for file reconstruction
  - DedupStats for storage statistics
- Add VfsDedupConfig:
  - block_size (default 4KB)
  - min_file_size threshold
  - store_path for dedup directory
- Add hex crate for hash encoding
- Block-level dedup foundation for SMB/ZFS

All 229 tests pass.
This commit is contained in:
Warren
2026-06-20 22:39:25 +08:00
parent 39a489d5c1
commit 37f5da7d6c
3 changed files with 222 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
pub mod compression;
pub mod dedup;
pub mod local_fs;
pub mod open_flags;
pub mod s3_fs;
@@ -430,3 +431,24 @@ pub struct VfsCompressionConfig {
/// 最小压缩大小(字节),小于此大小不压缩
pub min_size: u64,
}
/// 去重配置
#[derive(Debug, Clone)]
pub struct VfsDedupConfig {
/// 块大小字节默认4KB
pub block_size: usize,
/// 最小文件大小(字节),小于此大小不去重
pub min_file_size: u64,
/// 去重存储路径
pub store_path: PathBuf,
}
impl Default for VfsDedupConfig {
fn default() -> Self {
Self {
block_size: 4096,
min_file_size: 1024,
store_path: PathBuf::from(".dedup"),
}
}
}