Documentation
¶
Overview ¶
Package diskusage measures a directory tree twice: the size it appears to occupy, and the size deleting it would actually reclaim.
The two figures differ whenever content is hard-linked. pnpm links every package file from its content-addressed store into each project's node_modules, so a worktree that reports 1.4 GB of node_modules may free a few megabytes when it is removed. Measured across one WB fleet sweep: 11.7 GB apparent against 5.9 GB unshared over the same set of worktrees. Reporting only the apparent figure promises a reclaim the deletion cannot deliver, which is why every size WB reports carries both.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Usage ¶
Usage is one measured tree. ApparentBytes counts each inode's logical size once, the way `du --apparent-size` does. UnsharedBytes counts the physical blocks of the inodes whose every link lives inside the measured tree — the bytes removing the tree would return to the filesystem. SharedBytes is the apparent remainder: content the tree holds a link to but does not own.
type Walk ¶
type Walk struct {
// contains filtered or unexported fields
}
Walk measures several trees as one accounting unit.
Summing per-tree measurements is wrong across a fleet, and wrong in both directions. Two worktrees that hard-link the same pnpm store file each report its apparent size, so the total double-counts it; and when the only links to a file live in two measured worktrees, each tree calls it shared with something outside itself, so the total under-reports what removing both would return. A Walk answers the question a reclaim footer is actually asking — "how much comes back if I remove all of these?" — by counting every inode once and treating it as unshared exactly when every link to it is inside the selected set.