Documentation
¶
Overview ¶
Package fs2 sums logical sizes of CID-named regular files under a directory tree. Each file's hash is its path relative to the root with separators removed, so ab/cdefg is the hash abcdefg. That is the "2,-" split: the first two characters are the directory and the rest is the file name.
Bounds use the same half-open convention as hashspacesolver.Transfer: (low, high]. An empty low or high leaves that side open. SumFileSizesInterval also accepts a wrapped interval, where low sorts after high.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ListHashesInterval ¶
ListHashesInterval returns up to limit regular-file hashes in (low, high], lexicographic order, strictly after `after`. An empty low or high leaves that side open. When low sorts after high the interval wraps. When low and high are equal and non-empty, the interval is the whole circle.
Types ¶
type Result ¶
Result describes the regular files successfully included in a range sum.
func SumFileSizesInterval ¶
SumFileSizesInterval sums regular files whose concatenated path hash lies in the half-open interval (low, high]. When both bounds are set and low sorts after high, the interval wraps around the hash circle: hashes after low plus hashes up to high. Otherwise it matches SumFileSizesRange.
func SumFileSizesRange ¶
SumFileSizesRange sums logical file sizes for regular files under directory whose concatenated hash paths compare in the bytewise interval (low, high]. An empty low or high bound leaves that side of the interval open.
kBufSize is the io_uring queue size and the maximum number of outstanding statx requests for one directory. Zero selects 128. It is ignored when io_uring is unavailable and the portable directory walk is used instead.
liburing is not required. A ring is created and closed during init; if that fails, calls use the portable walk.
Performance: 1e6 files on a FireCuda 530 (low-end NVMe, ext4, cold & warm cache) took 0.7s and 10 MB RSS ( 60 total alloc), vs 3.3/2.4s and 183 MB RSS (448 total alloc) for the unix impl on the same machine. On a ST8000NE001 (7200 rpm, ext4):
Cold cache Warm Cache 7.7s 0.7s This impl. 7.6s 2.4/3.0s Unix impl.
RSS stays ~10 MB vs ~180 MB. Cold, both wait on disk metadata reads.