feat. Async pause - #1008
Open
TingDaoK wants to merge 9 commits into
Open
Conversation
TingDaoK
marked this pull request as ready for review
July 29, 2026 21:47
| * | ||
| * @return contiguously downloaded bytes | ||
| */ | ||
| public long getContinuesDownloadedBytes() { |
Contributor
There was a problem hiding this comment.
nit: i left a similar comment on c side and thought it was fixes, but looks like continues is a typo here and you meant contiguous
Contributor
Author
There was a problem hiding this comment.
aha, I fixed the place you point out in C. but looks like I forgot another one...
DmitriyMusatkin
approved these changes
Jul 29, 2026
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.
Java bindings for the aws-c-s3 async pause API
Binds the async pause and resume-token APIs from aws-c-s3#649. The existing
pause()is upload-only; this adds an async variant that covers uploads and downloads, plus a callback that hands back a resume token when a transfer fails unexpectedly.New API
S3MetaRequest.pauseAsync()Works for both
PUT_OBJECTandGET_OBJECT. The future completes only after in-flight work settles (in-flight parts for uploads, file writes for downloads), so the token reflects a quiesced state. Completes withnullwhen the request had not progressed far enough to produce resumable state, or exceptionally withCrtRuntimeExceptionif the pause itself failed.S3MetaRequestResponseHandler.onErrorResumeToken(int errorCode, ResumeToken resumeToken)New default method, invoked exactly once when a meta request fails unexpectedly, so callers can persist state and resume without re-transferring completed parts. Supported for uploads and downloads. Not invoked on success or explicit pause. The token is
nullwhen no resumable state was captured.Worth calling out: for a file download with
withResponseFileDeleteOnFailure(true), the deletion is respected — the partial file is deleted and the callback fires with anulltoken. Don't set that option if you intend to resume from this token.ResumeToken— download fieldsPreviously upload-only. Nine download getters added:
getEtag(),getVersionId(),getS3ObjectLastModified()(HTTP-date string),getObjectSize()(full object size regardless of Range),getObjectRangeStart(),getObjectRangeEnd()(inclusive),getContinuesDownloadedBytes()(contiguous prefix),getTotalDownloadedBytes(),getFileLastModifiedEpochNs().Type-specific getters throw
IllegalArgumentExceptionwhen read from the wrong token type, matching existinggetUploadId()behavior. UsegetType()to disambiguate.Known limitation
Consuming a download token to resume a GET isn't supported yet. Workaround: issue a new ranged GET from
getContinuesDownloadedBytes()(offset fromgetObjectRangeStart()) throughgetObjectRangeEnd(). Upload resume is unchanged viawithResumeToken().Testing
testS3PutPauseAsyncResume— 128MB MPU, pauses viapauseAsync().get(), asserts token fields and cross-type getter rejection, then resumes to completion.testS3GetPauseAsync— 10MB download with read backpressure so the transfer deterministically stalls before the pause, asserts all download token fields.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.