Expand description
Disk accounting: how much magi’s own directories occupy, how much space is left on the volume they live on, and how the shared build cache is pruned.
The whole module grew out of one incident: a machine with 951.8 GB of disk
ran a handful of competitions and ended up with 6.7 GB free and a pile of
multi-gigabyte target/ directories. Every function here exists to keep
that from being a discovery, and every number is substituted at a pure
boundary so the policy can be tested without asking the OS anything.
Structs§
- Prune
- What a prune removed, for the report.
Functions§
- dir_
size - Total bytes under
path, without following symlinks. - enough_
space - Are
freebytes above the floor for starting a run? - extract_
cargo_ target_ dir - The path a rendered command sets
CARGO_TARGET_DIR=to, if any. - free_
bytes - Free bytes on the volume containing
path. - gate
- Why a run must not start, given measured free bytes and the floor —
Nonemeans the gate is open. Pure, so the policy is asserted directly. - over_
limit - Is
sizepastlimit? One comparison, shared by the janitor and the health view, so both answer “is the cache over its cap” identically. - parse_
df_ available - One
df -k -Pdata row:Filesystem 1024-blocks Used Available …. - parse_
u64 - A bare unsigned integer line, which is all PowerShell prints for a long.
- prune_
dir - Delete files under
diroldest-first until its size is at or belowlimit. - volume_
root - The volume root of an absolute Windows path, as DriveInfo wants it:
C:\, neverC:\Users\...and never a verbatim\\?\C:\....