Skip to content

feat(upload): add driver independent upload sessions - #934

Merged
butonic merged 5 commits into
workpackagesfrom
port-703
Nov 3, 2026
Merged

butonic merged 5 commits into
workpackagesfrom
port-703

Conversation

@butonic

@butonic butonic commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

First PR of the upload coordinator stack. The goal: the storage drivers no longer run uploads themselves. A coordinator in pkg/upload receives the bytes (PUT and TUS), stages them, runs postprocessing and only then calls the driver: PrepareUpload before postprocessing, CommitUpload to write the bytes, RollbackUpload when it fails. The stack builds this up step by step and ends with removing the per-driver upload code in #949.

This PR adds the session part: pkg/upload sessions stage the bytes in a shared upload directory, persist the session and sign the data URL. Sessions carry a status (uploading, processing, failed) with a message, like the decomposedfs sessions did. Without a data gateway the session hands out the plain data server URL, because OpenCloud signs data URLs in the proxy and postprocessing (antivirus) could not download the bytes otherwise. Each staged chunk is synced to disk. Nothing uses the sessions yet.

Review focus:

  • session.go: the persisted session format and the status transitions, this is what the later PRs build on
  • filestore.go: the upload dir has to be on a shared filesystem when several pods serve a space
  • the data URL handling with and without a data gateway

Review commit by commit: the first commit is the generic change, the following ones adapt the pkg decomposedfs fork and posix.

stacked on #951

Assisted by Claude Code (claude-opus-5-5): it adapted the changes, split them into this stack and wrote this description.

@butonic butonic added the Type:Maintenance E.g. technical debt, packaging, etc. label Oct 29, 2026
@butonic
butonic added this pull request to stack #952 October 29, 2026 14:19
@butonic
butonic force-pushed the port-703 branch 3 times, most recently from 141fa49 to ac2b3fe Compare October 30, 2026 10:44
f-firas and others added 5 commits November 3, 2026 17:37
Upload sessions carry an explicit status (uploading, processing,
failed) with a message, as the decomposedfs sessions do. Listing
uploads shows it, and IsProcessing reports the processing status
instead of guessing from the offset and the scan result.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
… gateway

OpenCloud signs data URLs in the proxy, at the edge, so its storages
configure only the download endpoint. The session then signed a token
against an empty data gateway endpoint, and postprocessing got a bare
"/<token>" it could not download the staged bytes from: the virus scan
never ran. Return the data server URL itself in that case, as the
driver sessions did.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
The decomposedfs upload sessions synced every chunk right away, so an
upload could be resumed after a crash and slow disks were spared one
large flush at the end of the upload. Do the same in the coordinator's
sessions, and log failed chunk writes as they did.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
staticcheck S1016 flags the struct literal: both types have the same
fields, so a plain conversion does the job.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@butonic
butonic merged commit a8b0da1 into workpackages Nov 3, 2026
19 checks passed
@butonic
butonic deleted the port-703 branch November 3, 2026 23:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Type:Maintenance E.g. technical debt, packaging, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants