Skip to content

feat(storage): add TUSUploadEngine and UploadMethod smart routing#992

Open
grdsdev wants to merge 2 commits into
stacked/pr1-multipartfrom
stacked/pr2-tus
Open

feat(storage): add TUSUploadEngine and UploadMethod smart routing#992
grdsdev wants to merge 2 commits into
stacked/pr1-multipartfrom
stacked/pr2-tus

Conversation

@grdsdev
Copy link
Copy Markdown
Contributor

@grdsdev grdsdev commented May 7, 2026

Summary

Stacked on #991.

  • Adds TUSUploadEngine actor implementing TUS 1.0.0 resumable uploads with 6 MB chunks, pause/resume/cancel, 409 offset re-sync, and cooperative Swift Task cancellation
  • Adds UploadMethod enum (.auto, .multipart, .resumable) as a parameter on upload() and update()
  • .auto picks multipart for files ≤ 6 MB and TUS for larger files (configurable via tusChunkSize)

API changes

```swift
enum UploadMethod {
case auto // <= 6 MB -> multipart, > 6 MB -> TUS
case multipart // always single HTTP request
case resumable // always TUS; supports pause/resume/cancel
}

func upload(_ path: String, data: Data, options: FileOptions = .init(), method: UploadMethod = .auto) -> StorageUploadTask
```

Test plan

  • TUSUploadEngineTests — all pass
  • StorageFileAPITests — all pass (including method: .multipart and method: .resumable tests)

🤖 Generated with Claude Code

grdsdev and others added 2 commits May 8, 2026 06:06
- Add TUSUploadEngine actor implementing TUS 1.0.0 resumable uploads with
  6 MB chunks, pause/resume/cancel, 409 offset re-sync, and cooperative
  Swift Task cancellation
- Add UploadMethod enum (.auto, .multipart, .resumable) as a parameter on
  upload() and update()
- .auto picks multipart for files <= 6 MB and TUS for larger files
  (configurable via tusChunkSize)
- Add tusChunkSize to StorageClientConfiguration

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
@grdsdev grdsdev force-pushed the stacked/pr2-tus branch from 72af621 to f6cd959 Compare May 8, 2026 09:06
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.

1 participant