Skip to content

storage: return typed results from write operations - #986

Merged
dragonchaser merged 5 commits into
opencloud-eu:mainfrom
butonic:backport-typed-storage-results
Nov 11, 2026
Merged

dragonchaser merged 5 commits into
opencloud-eu:mainfrom
butonic:backport-typed-storage-results

Conversation

@butonic

@butonic butonic commented Nov 9, 2026 •

Copy link
Copy Markdown
Member

Storage drivers now return typed results from write operations instead of sending the space owner through a channel in the context. The events middleware reads the results from context slots after the handler has returned. One commit per upstream PR:

  • owncloud/reva#480 delete the old space image when a new one is set
  • owncloud/reva#615 typed results for CreateDir, TouchFile, RestoreRevision, RestoreRecycleItem, SetLock and Unlock
  • owncloud/reva#617 typed DeleteResult from Delete
  • owncloud/reva#622 typed DeleteStorageSpaceResult with space name and final members

The old channel could lose the owner: the middleware did a non-blocking select right after the handler returned, while a goroutine might still be about to send.

Where we diverged from upstream (details in the commit messages):

The later upstream fixes to these code paths are already on main: owncloud/reva#740 (#982) and owncloud/reva#732 (#909).

go test ./... is green. make test-integration fails 8 public link specs in access_test.go, and main fails the same 8 the same way: creating the link returns INTERNAL. opencloud main builds and vets against this branch via a go.work. Merging main into workpackages afterwards will conflict in pkg/storage/storage.go, upload_test.go, ocm.go and nextcloud.go.

AI: ported with Claude Code (claude-opus-5-5), which applied the upstream patches, resolved the conflicts and adapted the tests. Still a draft until I have gone through it myself.

max65482 and others added 5 commits November 9, 2026 17:40
Setting a new space image left the previous image file in the space, so
every image change wasted storage. We now remember the old image id and
delete it after the new one was successfully set. A failed delete is
ignored, the update itself already succeeded.

backport of owncloud#480

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
CreateDir, TouchFile, RestoreRevision, RestoreRecycleItem, SetLock and
Unlock now return a typed result with the space owner instead of
pushing it through a channel registered in the context. The events
middleware registers a slot, the storageprovider writes the owner from
the result into it, and the middleware reads it after the handler
returned. That replaces the goroutine + channel dance, which could drop
the owner when the select ran before the goroutine sent it.

The move result slot follows the same pattern now and the middleware
no longer builds an ItemMoved event without a move result.

Our trashbin interface differs from upstream (it is space id based and
returns the restored node), so Decomposedfs.RestoreRecycleItem builds
the result from the restored node instead of the trashbin returning it.
The cephfs, s3 and cbox eoswrapper drivers do not exist here.

backport of owncloud#615

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
FS.Delete now returns a DeleteResult with the space owner and the id of
the deleted node. The storageprovider puts it into a context slot and
the events middleware builds ItemTrashed from it, so the event carries
the id of the trashed node even when the request referenced it by
parent id and relative path.

We keep our stat before deleting: it rejects deleting files that are
still processing and puts the node id into the response opaque. For
drivers that do not return a result ItemTrashed falls back to that
opaque id before using the id from the request.

backport of owncloud#617

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
DeleteStorageSpace now returns a DeleteStorageSpaceResult. When purging,
decomposedfs captures the space name and the active members before it
deletes anything, and the events middleware builds SpaceDeleted from
that instead of the response opaque. Disabling returns an empty result.

Differences to upstream:
- the storageprovider still lists the space first, so non-members keep
  getting a not found, and it still fills the response opaque. Drivers
  without a result fall back to that opaque for SpaceDeleted.
- decomposedfs does not emit SpaceMembershipExpired while collecting the
  final members. In our tree the share manager emits that event, and the
  purge removes expired grants together with the space anyway. Expired
  grants are just left out.
- a failure to list the grants now aborts the purge instead of only
  being logged, we need them for the event.

backport of owncloud#622

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
The typed results added a second alias for the same package, which
staticcheck flags as ST1019. Use userpb everywhere.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@butonic butonic self-assigned this Nov 10, 2026
@butonic
butonic marked this pull request as ready for review November 10, 2026 12:36
@dragonchaser
dragonchaser merged commit e9b5696 into opencloud-eu:main Nov 11, 2026
20 checks passed
@openclouders openclouders mentioned this pull request Nov 11, 2026
1 task
butonic added a commit to opencloud-eu/opencloud that referenced this pull request Nov 11, 2026
Brings in opencloud-eu/reva#986: storage
drivers return typed results from write operations and the events
middleware reads the space owner, deleted ids and final space members
from those instead of a context channel and response opaques. Setting a
new space image now also deletes the old one.

chi, validator, go-jose, go-urn and locales are bumped to the minimum
versions reva main requires. The chi v5.4.0 ClientIP panic is already
fixed on main by #3937

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@openclouders openclouders mentioned this pull request Nov 12, 2026
1 task
NickWalters pushed a commit to NickWalters/reva that referenced this pull request Nov 16, 2026
Brings the typed storage results (opencloud-eu#986), the stuck synchronous upload
fix (opencloud-eu#976), the main-queue replica fix (opencloud-eu#984), the posix id cache fail
fast (opencloud-eu#989) and release 2.52.2 into workpackages.

The typed results were mostly mechanical: the ocm received driver keeps
its service account client, nextcloud keeps its real TouchFile (now
returning a TouchFileResult), and the coordinator ignores the TouchFile
result and still reads the node back, because not every driver fills
it.

opencloud-eu#976 patched the legacy upload session store, which workpackages
removed. Its recovery of nodes left processing by an interrupted
synchronous upload moves into the pkg fork as
Decomposedfs.recoverInterruptedUpload. The coordinator stages sessions
in the same <upload dir>/<id> and <id>.info layout as the old store, so
nodes stuck by older versions still heal on the first download.
Aspects.DisableVersioning stays gone, SeparateBlobs comes along.

The sync specs now drive uploads through the coordinator. The two
blob-first specs follow with the next commit, which moves the blob-first
write to the coordinator path.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants