Repository navigation
storage: return typed results from write operations - #986
Merged
dragonchaser merged 5 commits intoNov 11, 2026
Merged
Conversation
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]>
dragonchaser
approved these changes
Nov 11, 2026
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]>
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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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#480delete the old space image when a new one is setowncloud/reva#615typed results for CreateDir, TouchFile, RestoreRevision, RestoreRecycleItem, SetLock and Unlockowncloud/reva#617typed DeleteResult from Deleteowncloud/reva#622typed DeleteStorageSpaceResult with space name and final membersThe 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):
Decomposedfs. SoDecomposedfs.RestoreRecycleItembuilds the result itself and the posix trashbin is unchanged.IsEmptycame with AddHasTrashedItemsproperty #268SpaceMembershipExpired: decomposedfs does not emit it while collecting the final members. Since Backport and fix of space membership expired event #766 jsoncs3 emits it (space membership moved to the share provider in [feature/guest-links] Manage space membership in shareprovider #593). Expired grants are just left outService.Deletestill stats first: processing check plusopaque_idin the response (Extend events with required fields for search cs3org/reva#2798, Prevent space admin from listing other tennants spaces #412).ItemTrashedfalls back to that opaque id when a driver returns no result. Thedeleting_shared_resourceopaque stays gone (delete unused opaque property #609)Service.DeleteStorageSpacestill lists the space first (Add More Info to Events cs3org/reva#3704), so non-members keep getting a not found as of fix: status codes on DeleteStorageSpace #691 (our take onowncloud/reva#634). It still fills the opaque,SpaceDeletedfalls back to itowncloud/reva#616). This finishes the same patternstatus.go:NewTooEarlyis already here from Backport wp1 716 #888 (owncloud/reva#626). Upstream'sTooManyRequestsbelongs to the public link brute force protection and is not needed hereListGrantsnow aborts the purge instead of only being logged, same as upstreamThe later upstream fixes to these code paths are already on main:
owncloud/reva#740(#982) andowncloud/reva#732(#909).go test ./...is green.make test-integrationfails 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 inpkg/storage/storage.go,upload_test.go,ocm.goandnextcloud.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.