Documentation
¶
Overview ¶
Package quota enforces logical capacity limits and reports compressed, backend and cache usage. Reporting does not modify the namespace or backend.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrExceeded = errors.New("fuse quota exceeded")
ErrExceeded is returned when a logical write would exceed the configured quota. A zero limit means unlimited.
Functions ¶
Types ¶
type Report ¶
type Report struct {
LogicalBytes int64 `json:"logical_bytes"`
UniqueRawBytes int64 `json:"unique_raw_bytes"`
UniqueStoredBytes int64 `json:"unique_stored_bytes"`
BackendBytes int64 `json:"backend_bytes"`
CacheBytes int64 `json:"cache_bytes"`
QuotaLimitBytes int64 `json:"quota_limit_bytes"`
Files int64 `json:"files"`
Directories int64 `json:"directories"`
ReferencedChunks int64 `json:"referenced_chunks"`
UniqueChunks int64 `json:"unique_chunks"`
BackendObjects int64 `json:"backend_objects"`
CacheFiles int64 `json:"cache_files"`
CompressionRatio float64 `json:"compression_ratio"`
PhysicalSavingsPct float64 `json:"physical_savings_percent"`
}
Report is a point-in-time usage snapshot. LogicalBytes is the FUSE quota unit; stored and backend bytes describe the physical representations.
func Analyze ¶
func Analyze(ctx context.Context, namespace *meta.Namespace, objects backend.Backend, localCacheRoot string, quotaLimit int64) (Report, error)
Analyze reads the namespace, chunk objects and optional cache. A nil namespace or backend is allowed so callers can inspect only the sources they have available.
type State ¶
type State struct {
// contains filtered or unexported fields
}
State tracks the logical size targets accepted by the storage engine. It updates before asynchronous compression starts, so a fast writer cannot outrun the quota while worker jobs are still queued.
func NewState ¶
NewState initializes quota accounting from the current namespace. Zero means unlimited.