support byte-based storage watermark#141
Merged
Merged
Conversation
GetUsageInfo only accepted a percentage watermark, so callers wanting to keep a fixed amount of free space on large partitions had to derive and apply the reserved bytes themselves. Add a watermarkInBytes flag so the watermark is interpreted either as a percentage of total size or as an absolute reserved free-space amount, keeping the available-space math in one place. Signed-off-by: Andre Detsch <andre.detsch@foundries.io> Assisted-by: Claude Code:claude-opus-4-8
4d7fd10 to
4201e49
Compare
mike-sul
reviewed
Jun 19, 2026
| fmt.Fprintln(os.Stderr, | ||
| "warning: both --storage-usage-watermark and --reserved-storage are set; ignoring --storage-usage-watermark") | ||
| } | ||
| reserved, err := units.RAMInBytes(reservedStorage) |
Collaborator
There was a problem hiding this comment.
I would be great if we support both formats "MiB" and "MB". I think if we add add a wrapper like the following then we'll get it:
func ParseSize(s string) (int64, error) {
if strings.Contains(strings.ToLower(s), "ib") {
return units.RAMInBytes(s)
}
return units.FromHumanSize(s)
}
mike-sul
approved these changes
Jun 19, 2026
mike-sul
left a comment
Collaborator
There was a problem hiding this comment.
LGTM. Just not critical suggestion to improve UX.
The pull command only bounded storage usage via the percentage --storage-usage-watermark, a clumsy way to reserve a fixed amount of free space on large partitions. Add a separate --reserved-storage flag that takes an absolute size (e.g. "2GiB") so the two meanings stay unambiguous instead of overloading a single flag. reserved-storage takes precedence over --storage-usage-watermark: when both are set the percentage watermark is ignored and a warning is printed. GetUsageInfo is unchanged; the flags are resolved into its existing (watermark, inBytes) pair. Signed-off-by: Andre Detsch <andre.detsch@foundries.io> Assisted-by: Claude Code:claude-opus-4-8
Mirror the pull command so check exposes the same --reserved-storage flag for an absolute reserved free space (e.g. "2GiB") alongside the percentage --storage-usage-watermark, keeping the two commands consistent. reserved-storage takes precedence over --storage-usage-watermark; the resolution (including the both-set warning) is shared via resolveWatermark. Signed-off-by: Andre Detsch <andre.detsch@foundries.io> Assisted-by: Claude Code:claude-opus-4-8
4201e49 to
a1b3a4b
Compare
mike-sul
approved these changes
Jun 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Allow storage watermark to be set as bytes as well, for internal API, and CLI check and pull operations.
Re-use existing command line option. Interpret value as percentage as default (previous behavior), and as bytes if if has a suffix like "B" "GiB", etc.