v0.6.15: admin-editable storage quotas + S3 usage reporting (#178) #203
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "ship-v0.6.15"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
For review before deploy (not merged/tagged yet, per checkpoint).
Implements #178: usage visibility + per-user and instance caps that admins edit from the UI and that persist.
Backend
Usager(internal/storage/s3/usage.go):Usedsummed on demand over a flat bucket listing, cached ~60s. Object stores have no capacity, soTotal/Freeare left for the quota layer to fill.quota.go):SetLimits(getter)(same pattern asSetRetention); the per-user + instance caps come from the settings store at write time. Config quotas remain the seed/default.Usage()overlays the instance allowance asTotalwhen the backend reports none (POSIX real capacity is only tightened, never inflated). NewUserUsage(user)exposes the existing per-user tree-walk.main.gonow (previously skipped when config quotas were empty) so settings-driven caps enforce with no restart.quotaPerUserBytes+quotaInstanceBytes(admin-editable, persisted in the encrypted state-backend, validated non-negative).GET /api/v1/quota: instance figures to admins only; per-user figures (used + limit) to everyone.Frontend (Cairn's existing dialog/
.fieldsystem, no new visual language)/quota.Semantics
0= no limit on either axis. Enabling a cap on an already-over instance blocks new writes (over-quota error) but never deletes./home/<user>tree (ciphertext bytes under encryption); instance cap charges the whole bucket.go vet, fullgo test ./...(incl. updated/quotatests), node-check, dual-arch build all green.To try after deploy: set per-user + instance GB in Settings; upload past a cap → visible "quota exceeded"; every user sees their line in the account menu. Nothing merges/deploys until you say go.