How gblach/reflicate works
Project type and purpose
• This is a Rust-based command-line utility (CLI) named “Reflicate.”
• Its goal is to deduplicate files in specified directories by creating reflinks or hardlinks between identical files, using hashing and an index file for speed.
File structure
• Top-level:
• Cargo.toml, Cargo.lock: Rust project metadata and dependencies.
• src/: contains Rust source modules.
• systemd/: contains service/unit files for periodic execution.
• src/:
• main.rs – entry-point: parses CLI arguments, dispatches modes (dry-run, paranoid, indexfile).
• index.rs – indexfile management: read/write CDB+msgpack, track file metadata and hashes.
• utils.rs – hashing, file enumeration, reflink/hardlink wrappers.
• (possibly index.rs is named indexfile module, note utils.rs and indexfile functionality in README)
• systemd/:
• repliclate.service & repliclate.timer: example units to automate runs via systemd user timers.
README for additional insights
• Core flow: scan directories → collect file size & timestamps → compute blake3 (and xxhash in paranoid) → compare to index or peers → issue reflink/hardlink operations → update indexfile.
• External dependency: filesystem must support reflinks (e.g., XFS); fallback to hardlinks.
• Indexfile: constant-time lookup (CDB), serialization via msgpack.
Essential details to capture
• That indexfile both reads and writes metadata & hashes.
• Decision branch for hardlink vs reflink.
• Incremental optimization: skip hashing unchanged files.