quota

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2026 License: MIT Imports: 8 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

View Source
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

func SortedRefs

func SortedRefs(namespace *meta.Namespace) []chunk.Ref

SortedRefs returns the unique chunk references in hash order. It is useful for maintenance commands that need stable output without exposing the namespace's internal maps.

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

func NewState(limit int64, snapshot meta.Snapshot) *State

NewState initializes quota accounting from the current namespace. Zero means unlimited.

func (*State) Grow

func (q *State) Grow(inode uint64, size int64) error

func (*State) LimitBytes

func (q *State) LimitBytes() int64

func (*State) Reconcile

func (q *State) Reconcile(snapshot meta.Snapshot)

func (*State) Remove

func (q *State) Remove(inode uint64)

func (*State) Set

func (q *State) Set(inode uint64, size int64) error

func (*State) UsageBytes

func (q *State) UsageBytes() int64

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL