Expand description
Core scanning, sizing, caching, and removal logic for dsopt.
The scanner walks a filesystem root once with a rayon thread pool and reports
directories whose name matches a known build-artifact detector (node_modules
or target). Nested detectors are folded into their outermost parent so a
single removal reclaims the whole subtree.
Modules§
- app
- The
dsoptterminal user interface: scan, select, and reclaim. - update
- Self-update support: ask crates.io for the latest release and, when it is
newer than the running binary, reinstall through
cargo install.
Structs§
- Candidate
- A reclaimable directory together with the size of its whole subtree.
- File
Identity - Identity of a directory on its filesystem, used to collapse macOS volume aliases.
- Progress
Snapshot - Point-in-time copy of
ScanState, safe to render. - Scan
Cache - Serialized form of the most recent completed scan.
- Scan
Result - Outcome of a completed scan.
- Scan
State - Live counters shared between the walker threads and the progress reporter.
Enums§
- Candidate
Kind - A directory shape that
dsoptknows how to reclaim.
Constants§
- THREAD_
RANGE - Thread counts outside this range are rejected, matching the CLI contract.
Functions§
- cache_
path - Location of the on-disk scan cache, honouring
XDG_CACHE_HOME. - deduplicate_
candidates - Keep only the first candidate for each
(device, inode)pair. - format_
size - Render a byte count the way the TUI and CLI both display it.
- format_
timestamp - Format Unix seconds as
YYYY-MM-DD HH:MM UTCwithout pulling in a date crate. - is_
safe_ candidate - Whether
pathis a directory beneathscan_rootthat is safe to delete. - load_
scan_ cache - remove_
candidate - Permanently delete a candidate directory after a safety re-check.
- save_
scan_ cache - scan
- Scan a root with a fresh
ScanState. - scan_
with_ state - Scan a root, publishing live counters into
statewhile the walk runs. - should_
skip - Whether
pathsits on a virtual filesystem or macOS volume alias.