Skip to main content

Module disk

Module disk 

Source
Expand description

Filesystem free-space probing: statvfs on Unix, GetDiskFreeSpaceExW on Windows, both through fs4.

Two consumers share this: decdn node doctor compares the configured cache budget against the real volume advisorily, and the node’s eviction driver clamps its effective ceiling to real free disk each tick (#1930). Sharing one implementation keeps the advisory check and the runtime clamp measuring the same numbers.

Structs§

DiskSpace
Total and unprivileged-available bytes at a path.

Functions§

read_disk_space
Read filesystem capacity at path. On Unix, bytes = fragment size × block counts (f_frsize × f_blocks, f_frsize × f_bavail); on Windows, the caller-visible totals GetDiskFreeSpaceExW reports.
statvfs_target
Probe the path, or the nearest existing ancestor if it does not exist yet. The cache directory can be probed before it is created (pre-boot doctor) or after (the running eviction driver); walking to the nearest existing ancestor gives the right volume in both cases.