Repository navigation
Description
Is your feature request related to a problem? Please describe.
The revision cleanup (#1419, opencloud-eu/reva#895, #3778) has one strategy for the whole storage-users service: STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY. Personal spaces and project spaces often need different ones, though. An organization may want to keep few versions of personal files, and many more of the documents in a project space, which several people work on. Today an administrator has to pick one strategy for both, which either keeps too much in the personal spaces or too little in the project spaces.
A strategy per space, set on the space itself, is the subject of #3733, and comes later. A strategy per type of space covers the most common case first (it is option 2 in #3733), and its design leaves room for the per-space strategies.
Describe the solution you'd like
Only two types of space hold files with versions on the storage-users drivers: personal and project. The other types that show up in the code (share, virtual, mountpoint, grant) are views onto files in those spaces.
Configuration: two settings that override the default for one type:
STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY="30d" # the default, as today
STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY_PERSONAL="7d, 5" # personal spaces
STORAGE_USERS_REVISIONS_CLEANUP_STRATEGY_PROJECT="" # empty: the default applies
- Empty means the default applies,
disabledturns the cleanup off for that type even when the default has a strategy. - Spaces of any other type get the default.
The command opencloud storage-users revisions cleanup:
--strategy-personaland--strategy-projectreplace the configured strategy of that type for the run.--strategykeeps its meaning: it forces one strategy on every space of the run. Combined with--strategy-personalor--strategy-project, it is an error.- The output says which strategy each file got, and from where (forced, the space type, the default).
Metrics: the counters of deleted revisions, deleted bytes and failed deletions get a space_type label (personal, project, other). The metrics are not in a release yet, so this changes no existing series.
How it could be built, in reva's revision cleanup, which both posix and decomposed use:
- A
Policyreplaces the single strategy of the cleanup. It picks the strategy of each file, by layers, the most specific first: a forced strategy (the command's--strategy), the strategy of the type of the file's space (read from thespace.typeattribute of the space root), the default. - It decides by the file, which knows the root of its space, so that later additions only add layers: the per-space strategies of Per-space revision cleanup strategies #3733, stored on the space root, between the forced strategy and the type, and possibly rules by the type or the size of the file. Neither the background workers nor the command need to change for that.
- Later, a per-type option of the command will only replace the strategy of the type: a space's own strategy still wins, as it is more specific. Only
--strategyforces everything.
Describe alternatives you've considered
- One setting holding a strategy per type, e.g.
personal=7d, 5; project=90d: works for any future type without new settings, but it is harder to write as an environment variable and to document, and only two types exist. --strategyreplacing only the default: more specific settings would still win, which is consistent with the configuration, but it changes what--strategymeans today, and a forced strategy is what someone running the command by hand usually expects.
The options for strategies per space are discussed in #3733.
Additional context
Follow-up of #1419, before #3733 (strategies per space). Needs a reva PR (the Policy, the options, the metrics), an opencloud PR (configuration, command, acceptance tests) once #3778 is merged, and a docs PR after opencloud-eu/docs#1222.
AI assistance: Claude Code (claude-opus-5-5) looked into the types of spaces and how the cleanup picks its strategy, and wrote the first draft of this issue.
Activity