gravityfile is designed as a modular, high-performance system for file system exploration and analysis.
- Concurrency First: Every core module is built with parallelization as a first-class citizen using
tokio,rayon, andjwalk. - Memory Efficiency: Massive file systems are handled by minimizing heap allocations.
CompactStringand boxed optional fields (likecontent_hash) ensure low memory pressure. - Unified State: A single, source-of-truth
FileTreestructure powers all views (Usage, Duplicates, Age, Treemap). - Asynchronous TUI: The UI never blocks on I/O. Background tasks (scanning, hashing, analysis) communicate with the main loop via MPSC channels.
The heartbeat of the system.
FileNode: The fundamental unit of the tree. Featuresid-based lookups and lazy-loaded attributes.FileTree: A high-performance container for nodes. Includes advanced statistics tracking.- Error Types: Unified error handling across all crates.
The high-speed traversal engine.
JwalkScanner: Implements parallel directory traversal with customizable ignore rules (e.g.,.gitignore).InodeTracker: Prevents double-counting hardlinks across a single device by tracking (inode, device) pairs.- Git Integration: Uses
libgit2(viagit2-rs) to detect repository status in real-time.
The intelligence layer.
- Duplicate Detection: Uses a 3-phase algorithm for efficiency:
- Size Matching: Instant filtering of unique-sized files.
- Partial Hashing: Reads only the first and last 4KB of size-matched candidates.
- Full BLAKE3: Only performs full cryptographic hashes on final candidate groups.
- Age Analysis: Computes the distribution of file ages and identifies "stale" directories.
The file operation and safety engine.
OperationExecutor: Orchestrates copy, move, rename, and delete tasks.- Conflict Resolution: Implements interactive policies (Overwrite, Rename, Skip) for destination collisions.
- Undo System: Maintains a rolling log of reversible operations (excluding permanent deletions).
The interactive user interface.
- Layouts:
- Tree: Classical hierarchical view.
- Miller Columns: Ranger-style navigation for deep drill-downs.
- Treemap: Squarified space-filling visualization for rapid disk usage identification.
- Rendering: Highly optimized
ratatuiintegration with diff-based drawing and deferred updates.
- Traversal: ~500k files/sec (SSD, 12-core CPU).
- Memory Consumption: ~120MB per 1M nodes.
- Duplicate Detection: Scans 100GB of data for duplicates in <15s (I/O limited).
- Sandboxed Plugins: Third-party extensions run in isolated environments with restricted FS access.
- Safe Operations: Destructive operations default to Trash (via the
trashcrate) rather than permanent deletion. - No-Root Execution: gravityfile is designed to run with user-level permissions, gracefully handling permission errors without crashing.