Commit Graph
57 Commits
Author SHA1 Message Date
Pascal Bleser 5e8a88a05f feat: 1419: clean up revisions by the time they were created
Follows opencloud-eu/reva#895, which makes the revision cleanup go by
the time a revision was created, recorded by the server, instead of the
modification time of its content, which clients choose with X-OC-Mtime.
"auto" keeps the oldest revision of each slot (#3735).

- The storage-users README explains the new age of a revision.
- The acceptance scenario outline that checked the age as the time the
  content was written is replaced by two scenarios: versions whose
  content is dated 60 and 50 days ago are kept by "30d", and a version
  with content dated 10 years ahead doesn't push out the newest one
  under "1".

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 23:59:43 +01:00
Pascal Bleser a9b16e6745 fix: 1419: describe what a file metadata cache local to each process does
The revisions cleanup command, its help and the README said that, with
a cache local to each process, the server would keep listing the
revisions the command deleted until their cache entries expire or it
restarts. It doesn't: the server lists the revisions of a file from
disk. What it doesn't learn about is that they were deleted, so a list
of versions that is already open, e.g. in the Versions panel, keeps
showing them, and downloading or restoring one of them fails.

The command still refuses to run with such a cache, unless
--allow-local-cache is given: a shared cache is the right setup for a
command that changes the storage next to the server.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 23:59:43 +01:00
Pascal Bleser 498e5030e7 feat: 1419: let a dry run of the revisions cleanup keep a cache of its own
A dry run reads the metadata of every file it looks at. With a file
metadata cache shared with the server, e.g. 'nats-js-kv', it filled
that cache with entries for all of them, for a run that changes
nothing.

A dry run now always keeps its file metadata cache in its own memory,
whatever is configured. It doesn't need the shared cache: it deletes
nothing the server would have to see, and a cache of its own starts
empty, so it reads the metadata from disk. A real run still uses the
configured cache, which must be shared.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 23:59:43 +01:00
Pascal Bleser cae8a78da9 docs: 1419: a restore keeps the revision of the replaced content
The revision cleanup doesn't apply the strategy to the revision a
restore created of the content it replaced, not even an age limit,
as long as the file has the restored content. Say so next to the
strategies, as it is an exception admins wouldn't expect.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 23:59:43 +01:00
Pascal Bleser 1b0a81f39d feat: 1419: refuse to clean up revisions with a file metadata cache local to each process
The revisions cleanup command runs in a process of its own. With a file
metadata cache that each process keeps in its own memory ('memory', the
default, or 'ocmem'), the server doesn't learn about the revisions the
command deletes: a list of versions that is already open, e.g. in the
Versions panel, keeps showing them, and downloading or restoring one of
them fails. A new list is right, as the server lists them from disk.

The command now refuses to run with such a cache. The error says how to
share the cache (STORAGE_USERS_FILEMETADATA_CACHE_STORE=nats-js-kv, not
OC_CACHE_STORE, which sets the cache store of all services) and that
--allow-local-cache runs it anyway. A dry run deletes nothing and runs
with any cache.

The acceptance tests pass --allow-local-cache: their server runs with the
default cache, and they check the versions through the API, which lists
them from disk.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 23:59:43 +01:00
Pascal Bleser 26a7b4f903 feat: 1419: add a command to clean up old revisions on demand
'opencloud storage-users revisions cleanup' deletes old revisions,
according to a cleanup strategy, of:

- the files of spaces (--space, repeatable),
- or of a file or folder within a space (--space with --path),
- or of all spaces (--all),
- or of a file or folder given by its path on disk (--fs-path, posix
  only).

The id of a file or folder is rejected as the id of a space, as the
command would otherwise clean up its whole space. So is an id without a
space id, e.g. 'storage$'.

The storage-users service only cleans up the revisions of a file when it
gets a new one. The command also covers the files that are not changed
anymore, and applies a different strategy once.

The strategy and the settings of the background workers default to the
configured ones (STORAGE_USERS_REVISIONS_CLEANUP_*), and can be
overridden with --strategy, --async, --workers and --queue-size. Only
--queue-full defaults to 'block' without a timeout, whatever is
configured: the command finds files faster than the workers clean them
up, so dropping the files that find the queue full, or giving up after
the timeout meant for uploads, would skip most of them.
--queue-full-timeout sets one for the run.

The command uses the storage driver directly, in its own process, like
'uploads sessions': posix neither scans nor watches the file system, and
no driver joins the postprocessing consumer group of the service.

For posix, the driver needs NATS for its event stream. The command waits
for it 10 seconds at most, instead of the 15 minutes the stream retries
for, and ctrl-c also stops that wait: with the single binary, NATS only
runs within the server (opencloud-eu/opencloud#3805). The driver gets
the logger of the command: posix passes it on to the NATS connections
of its id cache, whose handlers would panic on a lost connection
without one. Ctrl-C also stops waiting for the driver, e.g. for the id
cache, which retries for up to 15 minutes as well.

Unless it is a dry run, which changes nothing on disk, the command
warns when the storage belongs to another user than the one it runs as,
e.g. root: the lock files it creates belong to that user, and the
server may not be able to lock these files anymore.

Output: a line for every file whose revisions were deleted, that failed
or that was skipped, with its path within its space, and a summary;
--verbose adds every file and every revision with the decision and its
reason; --json prints the same as JSON objects, one per line, with a
final summary object. --dry-run deletes nothing.

--timeout stops the cleanup gracefully, as does ctrl-c, and a second
ctrl-c ends the command right away, which can leave the blob of a
deleted revision behind; the help says so. Whether the timeout or ctrl-c
stopped the cleanup is told by the contexts of the command, not by the
error: the storage can return context errors of its own. --shuffle walks
the spaces and folders in a random order, so that repeated runs that
are stopped by the timeout, e.g. from a cron job, eventually reach all
files. The help explains that a file waiting for a lock can't be
interrupted, and that a dry run changes nothing on disk, but decides on
a snapshot, as it doesn't keep the files locked while it decides.

The common flags have short forms: -a (--all), -p (--fs-path),
-s (--strategy), -n (--dry-run), -v (--verbose), -j (--json) and
-t (--timeout).

Exit codes:

- 0 when done,
- 1 if the cleanup or any file failed, or if it was interrupted,
- 2 if the timeout stopped the cleanup before all files were cleaned
  up.

The storage-users README documents the command, along with the cleanup
strategies and how they relate to the configured cleanup.

Assisted-by: Claude Code:claude-opus-5-5
2026-11-23 23:59:43 +01:00
kobergj 7ddda68ec8 fix(storage-users): add --orphaned upload session filter
Upload sessions whose node metadata can no longer be read can never
finish postprocessing, stay in processing state indefinitely and keep
consuming the quota of their space.

Wire up the Orphaned session filter so operators can list the affected
sessions and remove them with --clean:

    opencloud storage-users uploads sessions --orphaned
    opencloud storage-users uploads sessions --orphaned --clean

Signed-off-by: Julian Koberg <julian.koberg@kiteworks.com>
2026-11-12 11:11:30 +01:00
André Duffeck 487313d06c Remove redis-sentinel from store descriptions
Redis isn't supported anymore. Also note that the posix driver needs
nats-js-kv for the id cache.
2026-11-10 12:26:09 +01:00
Ralf Haferkamp 606fe4ee1b fix(storage): map legacy drivers to supported backends
Related: #3819
2026-10-29 16:59:11 +01:00
Julian Koberg 059e9029bc fix: adjust to comments from CR
Signed-off-by: Julian Koberg <julian.koberg@kiteworks.com>
(cherry picked from commit 15b1c38e386c1e05ccea6a5f77fbca9786a52c87)
2026-10-15 09:24:22 +02:00
Julian Koberg 63028f2ace feat: add cli command to test the blobstore
Signed-off-by: Julian Koberg <julian.koberg@kiteworks.com>
(cherry picked from commit 1d2c329e66db9a406370554d91ce3951ec537ace)
2026-10-15 09:24:22 +02:00
Jörn Friedrich Dreyer 5ff51c1856 docs(storage-users): document the delete-stale-nodes command
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2026-10-05 14:12:21 +02:00
Klaas Freitag f94eedaee3 Clean invalid documentation links 2025-03-24 17:23:20 +01:00
Jörn Friedrich Dreyer 37404fda7e drop unused STORAGE_USERS_STAT_CACHE_STORE env var from readme
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-02-17 10:31:31 +01:00
André Duffeck 2b9e193584 Rebrand storage-users 2025-01-17 11:44:18 +01:00
Jörn Friedrich Dreyer a46fd132bd use OC_ env prefix
Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2025-01-13 16:11:11 +01:00
Martin Mattel bc3762bc08 [docs-only] Update service readme's 2024-11-04 16:45:11 +01:00
jkoberg c80254c4f1 feat(ocis): remove ocm store
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-10-15 17:24:51 +02:00
jkoberg 4a911ac047 feat(storage-users): remove metadata backend envvar
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-09-19 12:29:41 +02:00
Martin 5a2e3abbba Update services/storage-users/README.md 2024-06-03 14:53:12 +02:00
mmattel c1c0037a75 [docs-only] fix two service readme's 2024-06-03 11:55:46 +02:00
Martin 38a699839a [docs-only] Update storage-users README.md
Aligning `Example cases for expired uploads` to the admin docs. The original sentence was not clear.
2024-06-03 10:33:20 +02:00
Roman Perekhod beca8cdf2a export example 2024-05-22 10:40:09 +02:00
Roman PerekhodandMartin d83256e606 Update services/storage-users/README.md
Co-authored-by: Martin <github@diemattels.at>
2024-05-22 09:22:28 +02:00
Roman PerekhodandMartin 177f2c0c71 Update services/storage-users/README.md
Co-authored-by: Martin <github@diemattels.at>
2024-05-22 09:20:39 +02:00
Roman PerekhodandMartin e36ceea5f1 Update services/storage-users/README.md
Co-authored-by: Martin <github@diemattels.at>
2024-05-22 09:20:31 +02:00
Roman PerekhodandMartin d4a42b9911 Update services/storage-users/README.md
Co-authored-by: Martin <github@diemattels.at>
2024-05-22 09:20:23 +02:00
Roman PerekhodandMartin a9ce0f76e8 Update services/storage-users/README.md
Co-authored-by: Martin <github@diemattels.at>
2024-05-22 09:19:29 +02:00
Roman PerekhodandPhil Davis 505c598d17 Update services/storage-users/README.md
Co-authored-by: Phil Davis <phil@jankaritech.com>
2024-05-22 09:19:17 +02:00
Roman PerekhodandPhil Davis 38379646b1 Update services/storage-users/README.md
Co-authored-by: Phil Davis <phil@jankaritech.com>
2024-05-22 09:19:04 +02:00
Roman PerekhodandPhil Davis 3a01ff8060 Update services/storage-users/README.md
Co-authored-by: Phil Davis <phil@jankaritech.com>
2024-05-22 09:18:48 +02:00
Roman Perekhod 0cc79f0f80 added the details to the 'Restore Trash-Bins Items' doc section' 2024-05-21 17:19:07 +02:00
jkoberg e84c72b911 tiny docs fix
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-05-07 08:17:22 +02:00
Martin bc23b685b2 [docs-only] Typo in storage-users README.md
IMPOTANT --> IMPORTANT
2024-05-03 16:57:03 +02:00
jkoberg 62b128624d feat(storage-users): document sessions command
Signed-off-by: jkoberg <jkoberg@owncloud.com>
2024-05-03 10:31:41 +02:00
mmattel 31d13f06a2 [docs-only] fix two services readme to be inline with admin docs 2024-04-10 11:29:08 +02:00
mmattel a2526bcf66 [docs-only] Update storage-users readme 2024-03-15 12:12:01 +01:00
Jörn Friedrich Dreyer 3ed0424735 add more upload session filters (#7933)
* add more upload session filters

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* default descriptions

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update readme

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* use tablewriter, --json flag

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

* update readme

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>

---------

Signed-off-by: Jörn Friedrich Dreyer <jfd@butonic.de>
2024-01-26 09:21:32 +01:00
Roman PerekhodandRoman Perekhod 367f1ff9e8 trash-bin cli has been exteneded by the list and restore commands (#7917)
* trash-bin cli has been exteneded by the list and restore commands

* v4 to v5 changes

---------

Co-authored-by: Roman Perekhod <rperekhod@owncloud.com>
2023-12-19 15:44:28 +01:00
kobergjandMartin 423c28b298 improve store readmes
Co-authored-by: Martin <github@diemattels.at>
2023-12-15 13:25:10 +01:00
MartinandEdith Parzefall 6be90847b7 Update services/storage-users/README.md
Co-authored-by: Edith Parzefall <edith_parzefall@gmx.de>
2023-07-19 14:35:52 +02:00
mmattel 6c33d945f3 update readme 2023-07-19 13:27:30 +02:00
MartinandEdith Parzefall 35dd1fa173 Update services/storage-users/README.md
Co-authored-by: Edith Parzefall <edith_parzefall@gmx.de>
2023-07-19 13:02:48 +02:00
MartinandEdith Parzefall 1ec451d3d5 Apply suggestions from code review
Co-authored-by: Edith Parzefall <edith_parzefall@gmx.de>
2023-07-19 13:02:25 +02:00
mmattel 5f72c61089 envvar text fix and readme addon 2023-07-19 11:06:29 +02:00
mmattel 14153f86be [docs-only] Add new caching envvar to storage-users service 2023-05-22 17:10:54 +02:00
Martin 62a93bc9c4 Apply suggestions from code review 2023-05-04 09:06:46 +02:00
mmattel e89ea96470 [docs-only] Add readme.md note to not use xattrs anymore 2023-05-04 08:58:56 +02:00
EParzefall e2686f90b9 spelling fixes 2023-04-24 13:55:10 +02:00
Edith Parzefall 6d7b13c7a5 Apply suggestions from code review
language review
2023-04-24 12:33:37 +02:00