Replies: 2 comments
|
Scoped down from "resumable upload" (which would require picking a specific vendor protocol — tus.io, S3, GCS — none of which AsyncHTTPClient/NIO have any support for) to the one transport-agnostic piece that's actually useful: |
0 replies
|
Implementado em #266 — |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Overview
Full protocol-agnostic "resumable upload" isn't something this package can implement, and this discussion is scoped down to the one piece that actually is transport-agnostic: starting a file upload's byte stream at an arbitrary offset.
Why full resume support doesn't belong here
Standard HTTP has no universal "resume a POST/PUT" mechanism — unlike downloads, where
Range/206 Partial Contentis a real, standardized GET mechanism. Every resumable-upload scheme that exists (tus.io'sHEAD+Upload-Offsetprotocol, S3's Multipart Upload API, Google Cloud's resumable sessions, Azure Block Blob) is a vendor/application-level negotiation bolted on top of plain HTTP. Confirmed neither of this package's dependencies help here either: grepping bothAsyncHTTPClientandNIOCorefor resume/tus/Upload-Offset/Content-Rangeturns up nothing but generic Swift-concurrency "resume the continuation" hits, unrelated to file uploads. A generic HTTP client has no way to know which of these protocols (if any) the server on the other end speaks, so RequestDL can't bake in a real resume handshake without picking a specific backend to support.What's actually in scope:
Payload(url:from:)The one piece that is transport-agnostic is starting a file upload's byte stream at an arbitrary offset instead of from the start — and this is nearly free given what already exists. The file-backed stream buffer behind
FilePayloadFactoryalready does absolute-offsetpread/pwritewith aseek(to offset:)method (every syscall addresses an absolute offset, so nothing needs to scan from the start to reach a given position). Adding aPayload(url: fileURL, from: byteOffset)initializer that seeks there before streaming is a small, self-contained addition — no new I/O primitive required.Combined with
UploadStep(already public, already reportschunkSize/totalSizeper step viaAsyncResponse), a consumer can track bytes sent, and on failure, start a freshUploadTaskwith a payload beginning at that offset.Out of scope
.map-based consumer responsibility rather than a bespoke library feature.Milestone: 4.1.0
All reactions