Per-space quota: store, admin API, enforcement (#802, 767a) #805
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feat-802"
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?
Closes #802 (slice 1 of #767).
internal/spacequota: ID-keyed caps (spacequota.json, statestore-backed);Setrefuses < 1.spaceids.ByBackendDir: resolves a (possibly diverged) backend dir to the space id.SetSpaceLimit;prefixCaproutes a path to/home/<u>(per-user cap) or/spaces/<dir>(space cap), never both.room= max(cap − used, 0) + the size of the replaced file, so overwrites are net and a full or over-cap tree still accepts edits that don't grow it (per-user too).Copy/Renameoverrides pre-check the source size against the room when entering a different capped tree (these bypassed every cap before).SpaceUsagefor display.PUT/DELETE /api/v1/spaces/{name}/quota, admin-only, both kinds, audited (space-set-quota/space-clear-quota, registered verbs)./spacesentries and/metacarryquota+quotaUsedonly for capped spaces; uncapped ones never trigger a walk.POST /spacessets 1 GiB (defaultSpaceQuota, #800 follow-up).main.goopens the store, installs the lookup, passesQuota+SpaceUsageto both SpacesAPI modes.Checked the decorator stack order: versions sit below quota, so version copies aren't charged. A trash delete is a move to
/.trash(uncapped → passes unchecked); a restore into a full space is refused with 507, which is correct. A backend-dir converge rename resolves to an uncapped target and passes.Tests: RED commit
6f92b204(compile-red), green:go test ./...all ok, web 285/285.