Documentation
¶
Overview ¶
Package usage measures the instance's disk footprint: how many bytes the artifacts, backend state, logs, mirror clones, staging area, and database occupy, totalled and broken down per repo. Sizes are computed by walking the data dir on every call — previews are local-first and the tree is modest, so live numbers beat a stale cache.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DirSize ¶
DirSize walks root summing regular-file sizes. Unreadable entries are skipped: usage reporting must never fail on a permission oddity.
func Reclaimable ¶
Reclaimable totals only the categories a retention sweep can shrink — the baseline for reporting how much a sweep gave back.
Types ¶
type Dirs ¶
Dirs locates the trees a report covers. DBPath is the SQLite location actually opened (":memory:" for an ephemeral instance), not a default — reporting must size the real database, never a stale file from a previous on-disk run.
type DurableTier ¶ added in v0.11.0
DurableTier optionally reports the byte footprint of the durable artifact tier (S3/MinIO). When a tier backs the instance, local artifact directories are a cache — evicted while their deploys stay live — so the on-disk number alone understates what is retained and can read as data loss. Implemented by *s3store.Tier; nil on a single-node instance with no tier.
type RepoUsage ¶
type RepoUsage struct {
Repo string `json:"repo"`
// ArtifactsBytes covers published fe/be/dl artifacts *resident on local
// disk* — with a durable tier configured this is a cache, not the
// authoritative copy; StateBytes the mutable backend state dirs; LogsBytes
// build and run logs; MirrorBytes the bare git clone.
ArtifactsBytes int64 `json:"artifacts_bytes"`
StateBytes int64 `json:"state_bytes"`
LogsBytes int64 `json:"logs_bytes"`
MirrorBytes int64 `json:"mirror_bytes"`
TotalBytes int64 `json:"total_bytes"`
// Deploys counts the repo's non-evicted deploys; EvictedDeploys the
// evicted ones (rows kept as history, artifacts reclaimed).
Deploys int `json:"deploys"`
EvictedDeploys int `json:"evicted_deploys"`
}
RepoUsage is one repo's slice of the report.
type Report ¶
type Report struct {
TotalBytes int64 `json:"total_bytes"`
// ArtifactsBytes is the local-disk (resident) artifact footprint. With a
// durable tier configured it is a cache of DurableBytes, not the whole
// retained set — DurableTierConfigured says which regime is in effect so a
// shrinking ArtifactsBytes reads as eviction-from-cache, not data loss.
ArtifactsBytes int64 `json:"artifacts_bytes"`
StateBytes int64 `json:"state_bytes"`
LogsBytes int64 `json:"logs_bytes"`
MirrorBytes int64 `json:"mirror_bytes"`
TmpBytes int64 `json:"tmp_bytes"`
DBBytes int64 `json:"db_bytes"`
// DurableTierConfigured reports whether a durable artifact tier backs local
// disk. DurableBytes is the tier's total footprint, or 0 when no tier is
// configured or its size could not be read (best-effort — never fails the
// report). DurableBytes is not added into TotalBytes, which measures this
// instance's local disk.
DurableTierConfigured bool `json:"durable_tier_configured"`
DurableBytes int64 `json:"durable_bytes"`
Repos []RepoUsage `json:"repos"`
}
Report is the instance's disk usage, by category and by repo.