func (fs *Filesystem) CachedUsage() int64 {
	return atomic.LoadInt64(&fs.diskUsed)
}
Returns the cached value for the amount of disk space used by the filesystem. Do not rely on this
function for critical logical checks. It should only be used in areas where the actual disk usage
does not need to be perfect, e.g. API responses for server resource usage.
package filesystem
import (
	"sync"
	"sync/atomic"
	"syscall"
	"time"
	"emperror.dev/errors"
	"github.com/apex/log"
	"github.com/karrick/godirwalk"
)
type SpaceCheckingOpts struct {
	AllowStaleResponse bool
}
type usageLookupTime struct {
	sync.RWMutex
	value time.Time
}
func (ult *usageLookupTime) Set(t time.Time) {
	ult.Lock()
	ult.value = t
	ult.Unlock()
}
func (ult *usageLookupTime) Get() time.Time {
	ult.RLock()
	defer ult.RUnlock()
	return ult.value
}
func (fs *Filesystem) MaxDisk() int64 {
	return atomic.LoadInt64(&fs.diskLimit)
}
func (fs *Filesystem) SetDiskLimit(i int64) {
	atomic.SwapInt64(&fs.diskLimit, i)
}
func (fs *Filesystem) HasSpaceErr(allowStaleValue bool) error {
	if !fs.HasSpaceAvailable(allowStaleValue) {
		return newFilesystemError(ErrCodeDiskSpace, nil)
	}
	return nil
}
func (fs *Filesystem) HasSpaceAvailable(allowStaleValue bool) bool {
	size, err := fs.DiskUsage(allowStaleValue)
	if err != nil {
		log.WithField("root", fs.root).WithField("error", err).Warn("failed to determine root fs directory size")
	}
	if fs.MaxDisk() == 0 {
		return true
	}
	return size <= fs.MaxDisk()
}