Skip to content

Single File Upload/Download#3866

Open
narahavi wants to merge 3 commits into
mainfrom
tm-new
Open

Single File Upload/Download#3866
narahavi wants to merge 3 commits into
mainfrom
tm-new

Conversation

@narahavi

Copy link
Copy Markdown
Collaborator

Issue #, if available:

Description of changes:
Single File Upload/Download for TM 2.0
Check all that applies:

  • Did a review by yourself.
  • Added proper tests to cover this PR. (If tests are not applicable, explain.)
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@narahavi narahavi changed the title Tm new Single File Upload/Download Jul 14, 2026
@narahavi
narahavi marked this pull request as ready for review July 14, 2026 17:50
narahavi added 2 commits July 14, 2026 14:14
Implements single-file Upload and Download for the SEP-compliant S3 Transfer
Manager (aws-cpp-sdk-s3-transfer), backed by aws-c-s3 meta requests via the
aws-crt-cpp S3 bindings. Covers file and stream sources/sinks, progress and
finish callbacks, checksum config, cancellation, and CRT-to-SEP error mapping.

// Zero-copy stream download. Each part is delivered to the receiver in object order.
explicit DownloadRequest(
Aws::S3::Model::GetObjectRequest s3Request,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a big fan of requiring to construct with a different request type, thats not a preferable UX imo

// StandardHttpResponse's constructor eagerly invokes the request's response-stream factory to
// materialize its body stream; without this the factory is empty and aborts under -fno-exceptions.
httpRequest->SetResponseStreamFactory(Aws::Utils::Stream::DefaultResponseStreamFactoryMethod);
std::shared_ptr<Aws::Http::HttpResponse> response =

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we have to construct a temp request and a temp response? Can we not just construct an AwsError directly since that's all this function needs to return

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could technically construct an AwsError, but we'd still need to derive the actual error type which happens at the return with Aws::Client::S3ErrorMarshaller().BuildAWSError(response);
BuildAwsError takes an HttpResponse as input so we build a temp one and populate it with the CRT's status/body to parse the XML body into the proper S3Error.

Comment thread tests/aws-cpp-sdk-s3-transfer-integration-tests/DownloadTests.cpp
std::promise<OutcomeT> promise;
RequestT request;
uint64_t totalBytes = 0;
bool totalBytesHasBeenSet = false;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does totalBytes not need to be atomic?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totalBytes doesn't need to be atomic here because its only set once per dispatch for upload/download (download is set through the SetProgressCallback from crt). The user doesn't have a direct copy and outside of dispatch nothing ever updates or writes to it.

std::atomic<int> completeCount{0};
std::atomic<int> failedCount{0};
std::atomic<uint64_t> lastTransferredBytes{0};
std::atomic<uint64_t> maxTransferredBytes{0};

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: if the values cannot be negative and are purely for counting, use size_t

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants