feat: enforce tiered storage reservations

This commit is contained in:
2026-08-31 09:48:04 +00:00
parent 583b539f86
commit 611100f67c
12 changed files with 780 additions and 6 deletions
+22
View File
@@ -0,0 +1,22 @@
//go:build !windows
package store
import (
"errors"
"math"
"syscall"
)
func filesystemFreeBytes(path string) (uint64, error) {
var status syscall.Statfs_t
if err := syscall.Statfs(path, &status); err != nil {
return 0, err
}
blockSize := uint64(status.Bsize)
availableBlocks := uint64(status.Bavail)
if blockSize != 0 && availableBlocks > math.MaxUint64/blockSize {
return 0, errors.New("filesystem free-space value overflowed")
}
return availableBlocks * blockSize, nil
}