From 677481c79634c3c065fcb2bc3a6d8357d282c817 Mon Sep 17 00:00:00 2001 From: Vinay Narahari Date: Mon, 1 Jun 2026 10:42:15 -0400 Subject: [PATCH 1/7] Add aws-cpp-sdk-s3-transfer package scaffolding for Transfer Manager 2.0 --- cmake/sdks.cmake | 2 +- cmake/sdksCommon.cmake | 2 + src/aws-cpp-sdk-s3-transfer/CMakeLists.txt | 53 +++++++++++++++++++ .../include/aws/s3-transfer/DownloadRequest.h | 18 +++++++ .../aws/s3-transfer/DownloadResponse.h | 18 +++++++ .../aws/s3-transfer/ProgressListener.h | 18 +++++++ .../aws/s3-transfer/ProgressSnapshot.h | 18 +++++++ .../aws/s3-transfer/S3TransferManager.h | 18 +++++++ .../S3TransferManagerConfiguration.h | 18 +++++++ .../aws/s3-transfer/S3Transfer_EXPORTS.h | 28 ++++++++++ .../include/aws/s3-transfer/UploadRequest.h | 18 +++++++ .../include/aws/s3-transfer/UploadResponse.h | 18 +++++++ .../source/s3-transfer/S3TransferManager.cpp | 15 ++++++ 13 files changed, 243 insertions(+), 1 deletion(-) create mode 100644 src/aws-cpp-sdk-s3-transfer/CMakeLists.txt create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManagerConfiguration.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3Transfer_EXPORTS.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h create mode 100644 src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp diff --git a/cmake/sdks.cmake b/cmake/sdks.cmake index 28c0db501f06..4182fcc0f661 100644 --- a/cmake/sdks.cmake +++ b/cmake/sdks.cmake @@ -2,7 +2,7 @@ include(sdksCommon) set(SDK_DEPENDENCY_BUILD_LIST "") -set(NON_GENERATED_CLIENT_LIST access-management text-to-speech core queues s3-encryption identity-management transfer) ## Manually generated code with a name mimicking client name +set(NON_GENERATED_CLIENT_LIST access-management text-to-speech core queues s3-encryption identity-management transfer s3-transfer) ## Manually generated code with a name mimicking client name if(REGENERATE_CLIENTS OR REGENERATE_DEFAULTS) message(STATUS "Checking for SDK generation requirements") diff --git a/cmake/sdksCommon.cmake b/cmake/sdksCommon.cmake index a0220c83188f..fc3bcc180234 100644 --- a/cmake/sdksCommon.cmake +++ b/cmake/sdksCommon.cmake @@ -80,6 +80,7 @@ list(APPEND HIGH_LEVEL_SDK_LIST "access-management") list(APPEND HIGH_LEVEL_SDK_LIST "identity-management") list(APPEND HIGH_LEVEL_SDK_LIST "queues") list(APPEND HIGH_LEVEL_SDK_LIST "transfer") +list(APPEND HIGH_LEVEL_SDK_LIST "s3-transfer") list(APPEND HIGH_LEVEL_SDK_LIST "s3-encryption") list(APPEND HIGH_LEVEL_SDK_LIST "text-to-speech") @@ -141,6 +142,7 @@ list(APPEND SDK_DEPENDENCY_LIST "queues:sqs,core") list(APPEND SDK_DEPENDENCY_LIST "s3-encryption:s3,kms,core") list(APPEND SDK_DEPENDENCY_LIST "text-to-speech:polly,core") list(APPEND SDK_DEPENDENCY_LIST "transfer:s3,core") +list(APPEND SDK_DEPENDENCY_LIST "s3-transfer:s3,core") set(TEST_DEPENDENCY_LIST "") list(APPEND TEST_DEPENDENCY_LIST "cognito-identity:access-management,iam,core") diff --git a/src/aws-cpp-sdk-s3-transfer/CMakeLists.txt b/src/aws-cpp-sdk-s3-transfer/CMakeLists.txt new file mode 100644 index 000000000000..b4c19b6d5b2a --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/CMakeLists.txt @@ -0,0 +1,53 @@ +add_project(aws-cpp-sdk-s3-transfer + "High-level CRT-backed C++ SDK for file transfer to/from AWS S3" + aws-cpp-sdk-s3 + aws-cpp-sdk-core) + +file( GLOB S3_TRANSFER_HEADERS "include/aws/s3-transfer/*.h" ) + +file( GLOB S3_TRANSFER_SOURCE "source/s3-transfer/*.cpp" ) + +if(MSVC) + source_group("Header Files\\aws\\s3-transfer" FILES ${S3_TRANSFER_HEADERS}) + source_group("Source Files\\s3-transfer" FILES ${S3_TRANSFER_SOURCE}) +endif() + +file(GLOB ALL_S3_TRANSFER_HEADERS + ${S3_TRANSFER_HEADERS} +) + +file(GLOB ALL_S3_TRANSFER_SOURCE + ${S3_TRANSFER_SOURCE} +) + +file(GLOB ALL_S3_TRANSFER + ${ALL_S3_TRANSFER_HEADERS} + ${ALL_S3_TRANSFER_SOURCE} +) + +set(S3_TRANSFER_INCLUDES + "${CMAKE_CURRENT_SOURCE_DIR}/include/" +) + +include_directories(${S3_TRANSFER_INCLUDES}) + +if(USE_WINDOWS_DLL_SEMANTICS AND BUILD_SHARED_LIBS) + add_definitions("-DAWS_S3_TRANSFER_EXPORTS") +endif() + +add_library(${PROJECT_NAME} ${ALL_S3_TRANSFER}) +add_library(AWS::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} PUBLIC + $ + $) +target_link_libraries(${PROJECT_NAME} PRIVATE ${PLATFORM_DEP_LIBS} ${PROJECT_LIBS}) + +set_compiler_flags(${PROJECT_NAME}) +set_compiler_warnings(${PROJECT_NAME}) + +setup_install() + +install (FILES ${ALL_S3_TRANSFER_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/s3-transfer) + +do_packaging() diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h new file mode 100644 index 000000000000..15d6e4e2bece --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h @@ -0,0 +1,18 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + + +namespace Aws { + namespace S3 { + namespace Transfer { + class AWS_S3_TRANSFER_API DownloadRequest { + //need to fill in class defintion later + }; + } + } +} + diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h new file mode 100644 index 000000000000..7afd22a1b130 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h @@ -0,0 +1,18 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + + +namespace Aws { + namespace S3 { + namespace Transfer { + class AWS_S3_TRANSFER_API DownloadResponse { + //need to fill in class defintion later + }; + } + } +} + diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h new file mode 100644 index 000000000000..827edfdd5b09 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h @@ -0,0 +1,18 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + + +namespace Aws { + namespace S3 { + namespace Transfer { + class AWS_S3_TRANSFER_API ProgressListener { + //need to fill in class defintion later + }; + } + } +} + diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h new file mode 100644 index 000000000000..699c89d5a571 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h @@ -0,0 +1,18 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + + +namespace Aws { + namespace S3 { + namespace Transfer { + class AWS_S3_TRANSFER_API ProgressSnapshot { + //need to fill in class defintion later + }; + } + } +} + diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h new file mode 100644 index 000000000000..27a5e703bea0 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h @@ -0,0 +1,18 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + + +namespace Aws { + namespace S3 { + namespace Transfer { + class AWS_S3_TRANSFER_API S3TransferManager { + //need to fill in class defintion later + }; + } + } +} + diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManagerConfiguration.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManagerConfiguration.h new file mode 100644 index 000000000000..bb80deb4686e --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManagerConfiguration.h @@ -0,0 +1,18 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + + +namespace Aws { + namespace S3 { + namespace Transfer { + class AWS_S3_TRANSFER_API S3TransferManagerConfiguration { + //need to fill in class defintion later + }; + } + } +} + diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3Transfer_EXPORTS.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3Transfer_EXPORTS.h new file mode 100644 index 000000000000..fe7636bb9067 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3Transfer_EXPORTS.h @@ -0,0 +1,28 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#ifdef _MSC_VER + //disable windows complaining about max template size. + #pragma warning (disable : 4503) +#endif + +#if defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #ifdef _MSC_VER + #pragma warning(disable : 4251) + #endif // _MSC_VER + + #ifdef USE_IMPORT_EXPORT + #ifdef AWS_S3_TRANSFER_EXPORTS + #define AWS_S3_TRANSFER_API __declspec(dllexport) + #else + #define AWS_S3_TRANSFER_API __declspec(dllimport) + #endif // AWS_S3_TRANSFER_EXPORTS + #else // USE_IMPORT_EXPORT + #define AWS_S3_TRANSFER_API + #endif // USE_IMPORT_EXPORT +#else // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) + #define AWS_S3_TRANSFER_API +#endif // defined (USE_WINDOWS_DLL_SEMANTICS) || defined (_WIN32) diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h new file mode 100644 index 000000000000..56bba8475ce3 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h @@ -0,0 +1,18 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + + +namespace Aws { + namespace S3 { + namespace Transfer { + class AWS_S3_TRANSFER_API UploadResponse { + //need to fill in class defintion later + }; + } + } +} + diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h new file mode 100644 index 000000000000..56bba8475ce3 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h @@ -0,0 +1,18 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + + +namespace Aws { + namespace S3 { + namespace Transfer { + class AWS_S3_TRANSFER_API UploadResponse { + //need to fill in class defintion later + }; + } + } +} + diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp new file mode 100644 index 000000000000..992407a5caf3 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp @@ -0,0 +1,15 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. +* SPDX-License-Identifier: Apache-2.0. +*/ + +#include + + +namespace Aws { + namespace S3{ + namespace Transfer { + + } + } +} From 3dd9f19dc8c39bbd20a60a954be7519660497bed Mon Sep 17 00:00:00 2001 From: Vinay Narahari Date: Wed, 10 Jun 2026 10:47:26 -0400 Subject: [PATCH 2/7] Add SEP-required public API types for Transfer Manager 2.0 --- src/aws-cpp-sdk-s3-transfer/CMakeLists.txt | 10 +- .../include/aws/s3-transfer/DownloadHandle.h | 44 +++++++++ .../s3-transfer/DownloadProgressListener.h | 48 ++++++++++ .../s3-transfer/DownloadProgressSnapshot.h | 47 ++++++++++ .../include/aws/s3-transfer/DownloadRequest.h | 94 +++++++++++++++++-- .../aws/s3-transfer/DownloadResponse.h | 41 ++++++-- .../aws/s3-transfer/ProgressListener.h | 18 ---- .../aws/s3-transfer/ProgressSnapshot.h | 18 ---- .../aws/s3-transfer/S3TransferManager.h | 57 +++++++++-- .../include/aws/s3-transfer/UploadHandle.h | 44 +++++++++ .../aws/s3-transfer/UploadProgressListener.h | 48 ++++++++++ .../aws/s3-transfer/UploadProgressSnapshot.h | 46 +++++++++ .../include/aws/s3-transfer/UploadRequest.h | 94 +++++++++++++++++-- .../include/aws/s3-transfer/UploadResponse.h | 41 ++++++-- .../source/s3-transfer/DownloadHandle.cpp | 23 +++++ .../source/s3-transfer/S3TransferManager.cpp | 32 +++++-- .../source/s3-transfer/UploadHandle.cpp | 23 +++++ .../s3-transfer/internal/CrtOperations.cpp | 5 + .../s3-transfer/internal/CrtOperations.h | 10 ++ 19 files changed, 654 insertions(+), 89 deletions(-) create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h delete mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h delete mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h create mode 100644 src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp create mode 100644 src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp create mode 100644 src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp create mode 100644 src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.h diff --git a/src/aws-cpp-sdk-s3-transfer/CMakeLists.txt b/src/aws-cpp-sdk-s3-transfer/CMakeLists.txt index b4c19b6d5b2a..1dc3248f857e 100644 --- a/src/aws-cpp-sdk-s3-transfer/CMakeLists.txt +++ b/src/aws-cpp-sdk-s3-transfer/CMakeLists.txt @@ -7,17 +7,24 @@ file( GLOB S3_TRANSFER_HEADERS "include/aws/s3-transfer/*.h" ) file( GLOB S3_TRANSFER_SOURCE "source/s3-transfer/*.cpp" ) +file( GLOB S3_TRANSFER_INTERNAL_HEADERS "include/aws/s3-transfer/internal/*.h" ) +file( GLOB S3_TRANSFER_INTERNAL_SOURCE "source/s3-transfer/internal/*.cpp" ) + if(MSVC) source_group("Header Files\\aws\\s3-transfer" FILES ${S3_TRANSFER_HEADERS}) source_group("Source Files\\s3-transfer" FILES ${S3_TRANSFER_SOURCE}) + source_group("Header Files\\aws\\s3-transfer\\internal" FILES ${S3_TRANSFER_INTERNAL_HEADERS}) + source_group("Source Files\\s3-transfer\\internal" FILES ${S3_TRANSFER_INTERNAL_SOURCE}) endif() file(GLOB ALL_S3_TRANSFER_HEADERS ${S3_TRANSFER_HEADERS} + ${S3_TRANSFER_INTERNAL_HEADERS} ) file(GLOB ALL_S3_TRANSFER_SOURCE ${S3_TRANSFER_SOURCE} + ${S3_TRANSFER_INTERNAL_SOURCE} ) file(GLOB ALL_S3_TRANSFER @@ -48,6 +55,7 @@ set_compiler_warnings(${PROJECT_NAME}) setup_install() -install (FILES ${ALL_S3_TRANSFER_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/s3-transfer) +install (FILES ${S3_TRANSFER_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/s3-transfer) +install (FILES ${S3_TRANSFER_INTERNAL_HEADERS} DESTINATION ${INCLUDE_DIRECTORY}/aws/s3-transfer/internal) do_packaging() diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h new file mode 100644 index 000000000000..2ab3c3046f35 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h @@ -0,0 +1,44 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include +#include + + +namespace Aws { +namespace S3 { +namespace Transfer { + +class DownloadHandleImpl; + +/** + * Returned from S3TransferManager::Download to represent a single in-flight download. The + * handle is freely copyable; all copies share the same underlying transfer state. + */ +class AWS_S3_TRANSFER_API DownloadHandle { +public: + ~DownloadHandle(); + + /** + * Returns a future that resolves once the transfer finishes, succeeds, or fails. + */ + std::shared_future CompletionFuture() const; + + /** + * Requests cancellation of the in-flight download. Returns immediately; the future + * returned by CompletionFuture will resolve with a failure once the cancel takes effect. + */ + void Cancel(); + +private: + std::shared_ptr m_impl; +}; + + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h new file mode 100644 index 000000000000..5200d84a5ab8 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h @@ -0,0 +1,48 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + +namespace Aws { +namespace S3 { +namespace Transfer { + +class DownloadRequest; +class DownloadProgressSnapshot; + +/** + * Callback interface for receiving event-driven updates throughout the lifecycle of a download. + * Subclass and override the events of interest; default implementations are empty so unused + * callbacks can be ignored. Listeners may be registered on the request or on the manager. + */ +class AWS_S3_TRANSFER_API DownloadProgressListener { + public: + virtual ~DownloadProgressListener() = default; + + /** + * Invoked exactly once when the download begins, before any bytes have been transferred. + */ + virtual void OnTransferInitiated(const DownloadRequest&, const DownloadProgressSnapshot&) {} + + /** + * Invoked as bytes are received from S3. Called at least once for a successful transfer + * and may be called many times depending on object size and I/O buffer sizes. + */ + virtual void OnBytesTransferred(const DownloadRequest&, const DownloadProgressSnapshot&) {} + + /** + * Invoked exactly once when the download completes successfully. + */ + virtual void OnTransferComplete(const DownloadRequest&, const DownloadProgressSnapshot&) {} + + /** + * Invoked exactly once when the download fails or is cancelled. + */ + virtual void OnTransferFailed(const DownloadRequest&, const DownloadProgressSnapshot&) {} +}; + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h new file mode 100644 index 000000000000..6d3647b7062f --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h @@ -0,0 +1,47 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include +#include +#include + +namespace Aws { +namespace S3 { +namespace Transfer { + +/** + * Immutable snapshot of download progress passed to DownloadProgressListener callbacks. + * Captures bytes transferred, total bytes (known after the GetObject response is received), + * and the response once available. + */ +class AWS_S3_TRANSFER_API DownloadProgressSnapshot { + public: + DownloadProgressSnapshot(uint64_t transferredBytes, + uint64_t totalBytes, + std::shared_ptr response, + bool totalBytesHasBeenSet) + : m_transferredBytes(transferredBytes), + m_totalBytes(totalBytes), + m_response(std::move(response)), + m_totalBytesHasBeenSet(totalBytesHasBeenSet) {} + + inline uint64_t GetTransferredBytes() const { return m_transferredBytes; } + inline uint64_t GetTotalBytes() const { return m_totalBytes; } + inline bool TotalBytesHasBeenSet() const { return m_totalBytesHasBeenSet; } + inline const std::shared_ptr& GetResponse() const { return m_response; } + inline bool ResponseHasBeenSet() const { return m_response != nullptr; } + + private: + uint64_t m_transferredBytes = 0; + uint64_t m_totalBytes = 0; + std::shared_ptr m_response; + bool m_totalBytesHasBeenSet = false; +}; + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h index 15d6e4e2bece..9b2f1b05e78e 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h @@ -1,18 +1,94 @@ /** -* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include - +#include +#include +#include +#include +#include +#include +#include namespace Aws { - namespace S3 { - namespace Transfer { - class AWS_S3_TRANSFER_API DownloadRequest { - //need to fill in class defintion later - }; - } +namespace S3 { +namespace Transfer { + +/** + * Request type for S3TransferManager::Download. Carries the inner S3 GetObjectRequest along + * with the local destination (file path or stream factory) and any request-level progress + * listeners. The transfer manager parallelizes large objects via ranged GETs internally. + */ +class AWS_S3_TRANSFER_API DownloadRequest { + public: + inline const Aws::S3::Model::GetObjectRequest& GetS3Request() const { return m_s3Request; } + inline bool S3RequestHasBeenSet() const { return m_s3RequestHasBeenSet; } + template + void SetS3Request(S3RequestT&& val) { + m_s3RequestHasBeenSet = true; + m_s3Request = std::forward(val); + } + template + DownloadRequest& WithS3Request(S3RequestT&& value) { + SetS3Request(std::forward(value)); + return *this; } -} + inline const Aws::String& GetDestinationFilePath() const { return m_destinationFilePath; } + inline bool DestinationFilePathHasBeenSet() const { return m_destinationFilePathHasBeenSet; } + template + void SetDestinationFilePath(DestinationFilePathT&& value) { + m_destinationFilePathHasBeenSet = true; + m_destinationFilePath = std::forward(value); + } + template + DownloadRequest& WithDestinationFilePath(DestinationFilePathT&& value) { + SetDestinationFilePath(std::forward(value)); + return *this; + } + + inline const Aws::IOStreamFactory& GetBody() const { return m_body; } + inline bool BodyHasBeenSet() const { return m_bodyHasBeenSet; } + inline void SetBody(const Aws::IOStreamFactory& val) { + m_bodyHasBeenSet = true; + m_body = val; + } + inline DownloadRequest& WithBody(const Aws::IOStreamFactory& val) { + SetBody(val); + return *this; + } + + inline const Aws::Vector>& GetTransferListeners() const { + return m_transferListeners; + } + inline bool TransferListenersHasBeenSet() const { return m_transferListenersHasBeenSet; } + inline void SetTransferListeners(const Aws::Vector>& val) { + m_transferListenersHasBeenSet = true; + m_transferListeners = val; + } + inline DownloadRequest& WithTransferListeners(const Aws::Vector>& val) { + SetTransferListeners(val); + return *this; + } + inline DownloadRequest& AddTransferListener(const std::shared_ptr& listener) { + m_transferListenersHasBeenSet = true; + m_transferListeners.push_back(listener); + return *this; + } + + private: + Aws::S3::Model::GetObjectRequest m_s3Request; + Aws::String m_destinationFilePath; + Aws::IOStreamFactory m_body; + Aws::Vector> m_transferListeners; + bool m_s3RequestHasBeenSet = false; + bool m_destinationFilePathHasBeenSet = false; + bool m_bodyHasBeenSet = false; + bool m_transferListenersHasBeenSet = false; +}; + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h index 7afd22a1b130..0ed0423527a4 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h @@ -1,18 +1,41 @@ /** -* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include - +#include +#include namespace Aws { - namespace S3 { - namespace Transfer { - class AWS_S3_TRANSFER_API DownloadResponse { - //need to fill in class defintion later - }; - } +namespace S3 { +namespace Transfer { + +/** + * Response type returned via the DownloadHandle's future once the transfer completes. Wraps + * the underlying S3 GetObjectResult with whole-object content length and range, regardless + * of how many ranged GETs were issued internally. + */ +class AWS_S3_TRANSFER_API DownloadResponse { + public: + inline const Aws::S3::Model::GetObjectResult& GetS3Result() const { return m_s3Result; } + inline bool S3ResultHasBeenSet() const { return m_s3ResultHasBeenSet; } + template + void SetS3Result(GetObjectResultT&& getS3Result) { + m_s3ResultHasBeenSet = true; + m_s3Result = std::forward(getS3Result); } -} + template + DownloadResponse& WithS3Result(GetObjectResultT&& getS3Result) { + SetS3Result(std::forward(getS3Result)); + return *this; + } + + private: + Aws::S3::Model::GetObjectResult m_s3Result; + bool m_s3ResultHasBeenSet = false; +}; +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h deleted file mode 100644 index 827edfdd5b09..000000000000 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h +++ /dev/null @@ -1,18 +0,0 @@ -/** -* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -#pragma once -#include - - -namespace Aws { - namespace S3 { - namespace Transfer { - class AWS_S3_TRANSFER_API ProgressListener { - //need to fill in class defintion later - }; - } - } -} - diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h deleted file mode 100644 index 699c89d5a571..000000000000 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h +++ /dev/null @@ -1,18 +0,0 @@ -/** -* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. - * SPDX-License-Identifier: Apache-2.0. - */ -#pragma once -#include - - -namespace Aws { - namespace S3 { - namespace Transfer { - class AWS_S3_TRANSFER_API ProgressSnapshot { - //need to fill in class defintion later - }; - } - } -} - diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h index 27a5e703bea0..404575fdbf77 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h @@ -4,15 +4,56 @@ */ #pragma once #include - - +#include +#include +#include +#include +#include +#include namespace Aws { namespace S3 { - namespace Transfer { - class AWS_S3_TRANSFER_API S3TransferManager { - //need to fill in class defintion later - }; - } + namespace Transfer { + class S3TransferManagerImpl; + + /** + * High-level S3 transfer client backed by the AWS Common Runtime. Performs single-file + * uploads and downloads, automatically using multipart transfers for objects larger than + * the configured threshold. Customers hold an instance via shared_ptr; the manager owns + * the underlying CRT client and is not copyable or movable. + */ + class AWS_S3_TRANSFER_API S3TransferManager { + public: + /** + * Initialize the S3TransferManager with the given configuration. The configuration + * is used to construct the underlying CRT client and is not retained after construction. + */ + explicit S3TransferManager(const S3TransferManagerConfiguration& config); + + ~S3TransferManager(); + + S3TransferManager(const S3TransferManager&) = delete; + S3TransferManager& operator=(const S3TransferManager&) = delete; + S3TransferManager(S3TransferManager&&) = delete; + S3TransferManager& operator=(S3TransferManager&&) = delete; + + /** + * Begin uploading the object described by request. Returns immediately with a handle + * that can be used to wait for completion or to cancel the in-flight transfer. + */ + UploadHandle Upload(const UploadRequest& request); + + /** + * Begin downloading the object described by request. Returns immediately with a handle + * that can be used to wait for completion or to cancel the in-flight transfer. + */ + DownloadHandle Download(const DownloadRequest& request); + + private: + Aws::UniquePtr m_impl; + }; + } } -} + } + + diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h new file mode 100644 index 000000000000..842314542265 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h @@ -0,0 +1,44 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include +#include + + +namespace Aws { +namespace S3 { +namespace Transfer { + +class UploadHandleImpl; + +/** + * Returned from S3TransferManager::Upload to represent a single in-flight upload. The + * handle is freely copyable; all copies share the same underlying transfer state. + */ +class AWS_S3_TRANSFER_API UploadHandle { +public: + ~UploadHandle(); + + /** + * Returns a future that resolves once the transfer finishes, succeeds, or fails. + */ + std::shared_future CompletionFuture() const; + + /** + * Requests cancellation of the in-flight upload. Returns immediately; the future + * returned by CompletionFuture will resolve with a failure once the cancel takes effect. + */ + void Cancel(); + +private: + std::shared_ptr m_impl; +}; + + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h new file mode 100644 index 000000000000..d180877c3e73 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h @@ -0,0 +1,48 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + +namespace Aws { +namespace S3 { +namespace Transfer { + +class UploadRequest; +class UploadProgressSnapshot; + +/** + * Callback interface for receiving event-driven updates throughout the lifecycle of an upload. + * Subclass and override the events of interest; default implementations are empty so unused + * callbacks can be ignored. Listeners may be registered on the request or on the manager. + */ +class AWS_S3_TRANSFER_API UploadProgressListener { + public: + virtual ~UploadProgressListener() = default; + + /** + * Invoked exactly once when the upload begins, before any bytes have been transferred. + */ + virtual void OnTransferInitiated(const UploadRequest&, const UploadProgressSnapshot&) {} + + /** + * Invoked as bytes are submitted to S3. Called at least once for a successful transfer + * and may be called many times depending on object size and I/O buffer sizes. + */ + virtual void OnBytesTransferred(const UploadRequest&, const UploadProgressSnapshot&) {} + + /** + * Invoked exactly once when the upload completes successfully. + */ + virtual void OnTransferComplete(const UploadRequest&, const UploadProgressSnapshot&) {} + + /** + * Invoked exactly once when the upload fails or is cancelled. + */ + virtual void OnTransferFailed(const UploadRequest&, const UploadProgressSnapshot&) {} +}; + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h new file mode 100644 index 000000000000..b7d63a90851f --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h @@ -0,0 +1,46 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include +#include +#include + +namespace Aws { +namespace S3 { +namespace Transfer { + +/** + * Immutable snapshot of upload progress passed to UploadProgressListener callbacks. Captures + * bytes transferred, total bytes (known up-front for uploads), and the response once available. + */ +class AWS_S3_TRANSFER_API UploadProgressSnapshot { + public: + UploadProgressSnapshot(uint64_t transferredBytes, + uint64_t totalBytes, + std::shared_ptr response, + bool totalBytesHasBeenSet) + : m_transferredBytes(transferredBytes), + m_totalBytes(totalBytes), + m_response(std::move(response)), + m_totalBytesHasBeenSet(totalBytesHasBeenSet) {} + + inline uint64_t GetTransferredBytes() const { return m_transferredBytes; } + inline uint64_t GetTotalBytes() const { return m_totalBytes; } + inline bool TotalBytesHasBeenSet() const { return m_totalBytesHasBeenSet; } + inline const std::shared_ptr& GetResponse() const { return m_response; } + inline bool ResponseHasBeenSet() const { return m_response != nullptr; } + + private: + uint64_t m_transferredBytes = 0; + uint64_t m_totalBytes = 0; + std::shared_ptr m_response; + bool m_totalBytesHasBeenSet = false; +}; + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h index 56bba8475ce3..1bb93d8cb8e9 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h @@ -1,18 +1,94 @@ /** -* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include - +#include +#include +#include +#include +#include +#include namespace Aws { - namespace S3 { - namespace Transfer { - class AWS_S3_TRANSFER_API UploadResponse { - //need to fill in class defintion later - }; - } +namespace S3 { +namespace Transfer { + +/** + * Request type for S3TransferManager::Upload. Carries the inner S3 PutObjectRequest along + * with the local source (file path or stream) and any request-level progress listeners. + * The transfer manager chooses between a single PutObject and a multipart upload based on + * the configured threshold. + */ +class AWS_S3_TRANSFER_API UploadRequest { + public: + inline const Aws::S3::Model::PutObjectRequest& GetS3Request() const { return m_s3Request; } + inline bool S3RequestHasBeenSet() const { return m_s3RequestHasBeenSet; } + template + void SetS3Request(S3RequestT&& val) { + m_s3RequestHasBeenSet = true; + m_s3Request = std::forward(val); + } + template + UploadRequest& WithS3Request(S3RequestT&& value) { + SetS3Request(std::forward(value)); + return *this; } -} + inline const Aws::String& GetSourceFilePath() const { return m_sourceFilePath; } + inline bool SourceFilePathHasBeenSet() const { return m_sourceFilePathHasBeenSet; } + template + void SetSourceFilePath(SourceFilePathT&& value) { + m_sourceFilePathHasBeenSet = true; + m_sourceFilePath = std::forward(value); + } + template + UploadRequest& WithSourceFilePath(SourceFilePathT&& value) { + SetSourceFilePath(std::forward(value)); + return *this; + } + + inline const std::shared_ptr& GetBody() const { return m_body; } + inline bool BodyHasBeenSet() const { return m_bodyHasBeenSet; } + inline void SetBody(const std::shared_ptr& val) { + m_bodyHasBeenSet = true; + m_body = val; + } + inline UploadRequest& WithBody(const std::shared_ptr& val) { + SetBody(val); + return *this; + } + + inline const Aws::Vector>& GetTransferListeners() const { + return m_transferListeners; + } + inline bool TransferListenersHasBeenSet() const { return m_transferListenersHasBeenSet; } + inline void SetTransferListeners(const Aws::Vector>& val) { + m_transferListenersHasBeenSet = true; + m_transferListeners = val; + } + inline UploadRequest& WithTransferListeners(const Aws::Vector>& val) { + SetTransferListeners(val); + return *this; + } + inline UploadRequest& AddTransferListener(const std::shared_ptr& listener) { + m_transferListenersHasBeenSet = true; + m_transferListeners.push_back(listener); + return *this; + } + + private: + Aws::S3::Model::PutObjectRequest m_s3Request; + Aws::String m_sourceFilePath; + std::shared_ptr m_body; + Aws::Vector> m_transferListeners; + bool m_s3RequestHasBeenSet = false; + bool m_sourceFilePathHasBeenSet = false; + bool m_bodyHasBeenSet = false; + bool m_transferListenersHasBeenSet = false; +}; + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h index 56bba8475ce3..110aa3f22800 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h @@ -1,18 +1,41 @@ /** -* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #pragma once #include - +#include +#include namespace Aws { - namespace S3 { - namespace Transfer { - class AWS_S3_TRANSFER_API UploadResponse { - //need to fill in class defintion later - }; - } +namespace S3 { +namespace Transfer { + +/** + * Response type returned via the UploadHandle's future once the transfer completes. Wraps + * the underlying S3 PutObjectResult, populated from either the single PutObject response + * or the CompleteMultipartUpload response depending on the path taken. + */ +class AWS_S3_TRANSFER_API UploadResponse { + public: + inline const Aws::S3::Model::PutObjectResult& GetS3Result() const { return m_s3Result; } + inline bool S3ResultHasBeenSet() const { return m_s3ResultHasBeenSet; } + template + void SetS3Result(S3ResultT&& s3Result) { + m_s3ResultHasBeenSet = true; + m_s3Result = std::forward(s3Result); } -} + template + UploadResponse& WithS3Result(S3ResultT&& s3Result) { + SetS3Result(std::forward(s3Result)); + return *this; + } + + private: + Aws::S3::Model::PutObjectResult m_s3Result; + bool m_s3ResultHasBeenSet = false; +}; +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp new file mode 100644 index 000000000000..6810a6c878c1 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp @@ -0,0 +1,23 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + #include + + namespace Aws { + namespace S3 { + namespace Transfer { + class DownloadHandleImpl { + + }; + DownloadHandle::~DownloadHandle() = default; + + std::shared_future DownloadHandle::CompletionFuture() const { + return {}; + } + void DownloadHandle::Cancel() { + + } + } + } + } diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp index 992407a5caf3..baf1d513aa5b 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp @@ -1,15 +1,31 @@ /** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. -* SPDX-License-Identifier: Apache-2.0. -*/ - + * SPDX-License-Identifier: Apache-2.0. + */ #include - +#include namespace Aws { - namespace S3{ - namespace Transfer { +namespace S3 { +namespace Transfer { +class S3TransferManagerImpl { + +}; +S3TransferManager::~S3TransferManager() = default; + +S3TransferManager::S3TransferManager(const S3TransferManagerConfiguration& ) : +m_impl(Aws::MakeUnique("S3TransferManager")) { + +} - } - } +UploadHandle S3TransferManager::Upload(const UploadRequest&) { + return UploadHandle(); +} + +DownloadHandle S3TransferManager::Download(const DownloadRequest&) { + return DownloadHandle(); +} + +} +} } diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp new file mode 100644 index 000000000000..36dc39a0d5a6 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp @@ -0,0 +1,23 @@ +/** +* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ + #include + + namespace Aws { + namespace S3 { + namespace Transfer { + class UploadHandleImpl { + + }; + UploadHandle::~UploadHandle() = default; + + std::shared_future UploadHandle::CompletionFuture() const { + return {}; + } + void UploadHandle::Cancel() { + + } + } + } + } diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp new file mode 100644 index 000000000000..a20a8989f78d --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp @@ -0,0 +1,5 @@ +// +// Created by Narahari, Vinay on 6/5/26. +// + +#include "CrtOperations.h" diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.h b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.h new file mode 100644 index 000000000000..184e4d89777d --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.h @@ -0,0 +1,10 @@ +// +// Created by Narahari, Vinay on 6/5/26. +// + +#ifndef AWSSDK_CRTOPERATIONS_H +#define AWSSDK_CRTOPERATIONS_H + +class CrtOperations {}; + +#endif // AWSSDK_CRTOPERATIONS_H From ee302dc6203cb23e7769da0edfc0961474de2988 Mon Sep 17 00:00:00 2001 From: Vinay Narahari Date: Wed, 10 Jun 2026 16:27:08 -0400 Subject: [PATCH 3/7] TM Scaffolding Updates --- .../include/aws/s3-transfer/DownloadHandle.h | 2 +- .../aws/s3-transfer/DownloadResponse.h | 5 +++ .../aws/s3-transfer/S3TransferManager.h | 9 ++-- .../S3TransferManagerConfiguration.h | 2 +- .../include/aws/s3-transfer/UploadHandle.h | 2 +- .../include/aws/s3-transfer/UploadResponse.h | 5 +++ .../aws/s3-transfer/internal/CrtOperations.h | 44 +++++++++++++++++++ .../source/s3-transfer/DownloadHandle.cpp | 2 +- .../source/s3-transfer/S3TransferManager.cpp | 7 +++ .../source/s3-transfer/UploadHandle.cpp | 2 +- .../s3-transfer/internal/CrtOperations.cpp | 28 ++++++++++-- .../s3-transfer/internal/CrtOperations.h | 10 ----- 12 files changed, 93 insertions(+), 25 deletions(-) create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h delete mode 100644 src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.h diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h index 2ab3c3046f35..462072776681 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h @@ -26,7 +26,7 @@ class AWS_S3_TRANSFER_API DownloadHandle { /** * Returns a future that resolves once the transfer finishes, succeeds, or fails. */ - std::shared_future CompletionFuture() const; + std::shared_future CompletionFuture() const; /** * Requests cancellation of the in-flight download. Returns immediately; the future diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h index 0ed0423527a4..7ce3d3989c0c 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h @@ -4,6 +4,9 @@ */ #pragma once #include +#include +#include +#include #include #include @@ -36,6 +39,8 @@ class AWS_S3_TRANSFER_API DownloadResponse { bool m_s3ResultHasBeenSet = false; }; +typedef Aws::Utils::Outcome> DownloadOutcome; + } } } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h index 404575fdbf77..55d06bca7c84 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h @@ -21,13 +21,9 @@ namespace Aws { * the configured threshold. Customers hold an instance via shared_ptr; the manager owns * the underlying CRT client and is not copyable or movable. */ - class AWS_S3_TRANSFER_API S3TransferManager { + class AWS_S3_TRANSFER_API S3TransferManager: public std::enable_shared_from_this { public: - /** - * Initialize the S3TransferManager with the given configuration. The configuration - * is used to construct the underlying CRT client and is not retained after construction. - */ - explicit S3TransferManager(const S3TransferManagerConfiguration& config); + static std::shared_ptr Create(const S3TransferManagerConfiguration& config); ~S3TransferManager(); @@ -49,6 +45,7 @@ namespace Aws { DownloadHandle Download(const DownloadRequest& request); private: + explicit S3TransferManager(const S3TransferManagerConfiguration& config); Aws::UniquePtr m_impl; }; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManagerConfiguration.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManagerConfiguration.h index bb80deb4686e..f8cd24fa03f3 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManagerConfiguration.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManagerConfiguration.h @@ -10,7 +10,7 @@ namespace Aws { namespace S3 { namespace Transfer { class AWS_S3_TRANSFER_API S3TransferManagerConfiguration { - //need to fill in class defintion later + //need to fill in class definition later }; } } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h index 842314542265..3cec44b7c34d 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h @@ -26,7 +26,7 @@ class AWS_S3_TRANSFER_API UploadHandle { /** * Returns a future that resolves once the transfer finishes, succeeds, or fails. */ - std::shared_future CompletionFuture() const; + std::shared_future CompletionFuture() const; /** * Requests cancellation of the in-flight upload. Returns immediately; the future diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h index 110aa3f22800..e09f73168fab 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h @@ -4,6 +4,9 @@ */ #pragma once #include +#include +#include +#include #include #include @@ -36,6 +39,8 @@ class AWS_S3_TRANSFER_API UploadResponse { bool m_s3ResultHasBeenSet = false; }; +typedef Aws::Utils::Outcome> UploadOutcome; + } } } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h new file mode 100644 index 000000000000..7bcaeba24a6e --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h @@ -0,0 +1,44 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once + +#include +#include +#include +#include + +namespace Aws { +namespace S3 { +namespace Transfer { + +class S3TransferManagerImpl; + +namespace Internal { + +/** + * Translates TM 2.0 request types into aws-c-s3 meta request options, dispatches + * the meta request, and routes CRT callbacks back into TM 2.0 listener events. + * Internal to the s3-transfer package; not part of the public API. + */ +class CrtOperations { + // need to fill in proper definitions in future phase + public: + /** + * Dispatch an upload as a CRT meta request. Returns a handle bound to the + * in-flight request. + */ + static UploadHandle DispatchUpload(S3TransferManagerImpl& impl, const UploadRequest& request); + + /** + * Dispatch a download as a CRT meta request. Returns a handle bound to the + * in-flight request. + */ + static DownloadHandle DispatchDownload(S3TransferManagerImpl& impl, const DownloadRequest& request); +}; + +} +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp index 6810a6c878c1..d647b1590380 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp @@ -12,7 +12,7 @@ }; DownloadHandle::~DownloadHandle() = default; - std::shared_future DownloadHandle::CompletionFuture() const { + std::shared_future DownloadHandle::CompletionFuture() const { return {}; } void DownloadHandle::Cancel() { diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp index baf1d513aa5b..5b70e1ef1098 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp @@ -18,6 +18,13 @@ m_impl(Aws::MakeUnique("S3TransferManager")) { } +std::shared_ptr S3TransferManager::Create(const S3TransferManagerConfiguration& config) { + struct MakeSharedEnabler : public S3TransferManager { + MakeSharedEnabler(const S3TransferManagerConfiguration& config) : S3TransferManager(config) {} + }; + return Aws::MakeShared("S3TransferManager", config); +} + UploadHandle S3TransferManager::Upload(const UploadRequest&) { return UploadHandle(); } diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp index 36dc39a0d5a6..aac8136bebe1 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp @@ -12,7 +12,7 @@ }; UploadHandle::~UploadHandle() = default; - std::shared_future UploadHandle::CompletionFuture() const { + std::shared_future UploadHandle::CompletionFuture() const { return {}; } void UploadHandle::Cancel() { diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp index a20a8989f78d..302ff359fc96 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp @@ -1,5 +1,25 @@ -// -// Created by Narahari, Vinay on 6/5/26. -// +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ -#include "CrtOperations.h" +#include + +namespace Aws { +namespace S3 { +namespace Transfer { +namespace Internal { +// need to fill in proper definitions in future phase + +UploadHandle CrtOperations::DispatchUpload(S3TransferManagerImpl&, const UploadRequest&) { + return UploadHandle(); +} + +DownloadHandle CrtOperations::DispatchDownload(S3TransferManagerImpl&, const DownloadRequest&) { + return DownloadHandle(); +} + +} +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.h b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.h deleted file mode 100644 index 184e4d89777d..000000000000 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.h +++ /dev/null @@ -1,10 +0,0 @@ -// -// Created by Narahari, Vinay on 6/5/26. -// - -#ifndef AWSSDK_CRTOPERATIONS_H -#define AWSSDK_CRTOPERATIONS_H - -class CrtOperations {}; - -#endif // AWSSDK_CRTOPERATIONS_H From cbe24dc484ffe350b56f8f14375eaaa7dc46ed79 Mon Sep 17 00:00:00 2001 From: Vinay Narahari Date: Wed, 10 Jun 2026 16:52:59 -0400 Subject: [PATCH 4/7] TM Scaffolding Updates - cleanup --- .../include/aws/s3-transfer/internal/CrtOperations.h | 1 - .../source/s3-transfer/internal/CrtOperations.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h index 7bcaeba24a6e..81e129f25b65 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h @@ -23,7 +23,6 @@ namespace Internal { * Internal to the s3-transfer package; not part of the public API. */ class CrtOperations { - // need to fill in proper definitions in future phase public: /** * Dispatch an upload as a CRT meta request. Returns a handle bound to the diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp index 302ff359fc96..6474dfc68026 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/internal/CrtOperations.cpp @@ -9,7 +9,6 @@ namespace Aws { namespace S3 { namespace Transfer { namespace Internal { -// need to fill in proper definitions in future phase UploadHandle CrtOperations::DispatchUpload(S3TransferManagerImpl&, const UploadRequest&) { return UploadHandle(); From 976f5fcac5ea5ee5ccfbf6ebee5b7c2eb7d2626c Mon Sep 17 00:00:00 2001 From: Vinay Narahari Date: Thu, 11 Jun 2026 15:24:30 -0400 Subject: [PATCH 5/7] Updates to TM headers --- .../include/aws/s3-transfer/DownloadHandle.h | 8 ++- .../s3-transfer/DownloadProgressListener.h | 8 +-- .../s3-transfer/DownloadProgressSnapshot.h | 3 +- .../include/aws/s3-transfer/DownloadRequest.h | 69 ++++--------------- .../aws/s3-transfer/DownloadResponse.h | 2 +- .../aws/s3-transfer/S3TransferManager.h | 15 ++-- .../include/aws/s3-transfer/UploadHandle.h | 8 ++- .../aws/s3-transfer/UploadProgressListener.h | 8 +-- .../aws/s3-transfer/UploadProgressSnapshot.h | 2 +- .../include/aws/s3-transfer/UploadRequest.h | 69 ++++--------------- .../include/aws/s3-transfer/UploadResponse.h | 2 +- .../aws/s3-transfer/internal/CrtOperations.h | 10 +-- .../source/s3-transfer/DownloadHandle.cpp | 4 +- .../source/s3-transfer/S3TransferManager.cpp | 7 -- .../source/s3-transfer/UploadHandle.cpp | 4 +- 15 files changed, 67 insertions(+), 152 deletions(-) diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h index 462072776681..1f01af727f6e 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h @@ -19,14 +19,16 @@ class DownloadHandleImpl; * Returned from S3TransferManager::Download to represent a single in-flight download. The * handle is freely copyable; all copies share the same underlying transfer state. */ -class AWS_S3_TRANSFER_API DownloadHandle { +class AWS_S3_TRANSFER_API DownloadHandle final { public: ~DownloadHandle(); + DownloadHandle(DownloadHandle&&) noexcept; + DownloadHandle& operator=(DownloadHandle&&) noexcept; /** * Returns a future that resolves once the transfer finishes, succeeds, or fails. */ - std::shared_future CompletionFuture() const; + std::future CompletionFuture(); /** * Requests cancellation of the in-flight download. Returns immediately; the future @@ -35,7 +37,7 @@ class AWS_S3_TRANSFER_API DownloadHandle { void Cancel(); private: - std::shared_ptr m_impl; + std::unique_ptr m_impl; }; diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h index 5200d84a5ab8..74029d441f27 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h @@ -24,23 +24,23 @@ class AWS_S3_TRANSFER_API DownloadProgressListener { /** * Invoked exactly once when the download begins, before any bytes have been transferred. */ - virtual void OnTransferInitiated(const DownloadRequest&, const DownloadProgressSnapshot&) {} + virtual void OnTransferInitiated(const DownloadRequest& /*request*/, const DownloadProgressSnapshot& /*snapshot*/) {} /** * Invoked as bytes are received from S3. Called at least once for a successful transfer * and may be called many times depending on object size and I/O buffer sizes. */ - virtual void OnBytesTransferred(const DownloadRequest&, const DownloadProgressSnapshot&) {} + virtual void OnBytesTransferred(const DownloadRequest& /*request*/, const DownloadProgressSnapshot& /*snapshot*/) {} /** * Invoked exactly once when the download completes successfully. */ - virtual void OnTransferComplete(const DownloadRequest&, const DownloadProgressSnapshot&) {} + virtual void OnTransferComplete(const DownloadRequest& /*request*/, const DownloadProgressSnapshot& /*snapshot*/) {} /** * Invoked exactly once when the download fails or is cancelled. */ - virtual void OnTransferFailed(const DownloadRequest&, const DownloadProgressSnapshot&) {} + virtual void OnTransferFailed(const DownloadRequest& /*request*/, const DownloadProgressSnapshot& /*snapshot*/) {} }; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h index 6d3647b7062f..8911d6cc06b0 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h @@ -18,7 +18,8 @@ namespace Transfer { * Captures bytes transferred, total bytes (known after the GetObject response is received), * and the response once available. */ -class AWS_S3_TRANSFER_API DownloadProgressSnapshot { + +class AWS_S3_TRANSFER_API DownloadProgressSnapshot final { public: DownloadProgressSnapshot(uint64_t transferredBytes, uint64_t totalBytes, diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h index 9b2f1b05e78e..69eb938e2d5d 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadRequest.h @@ -21,72 +21,31 @@ namespace Transfer { * with the local destination (file path or stream factory) and any request-level progress * listeners. The transfer manager parallelizes large objects via ranged GETs internally. */ -class AWS_S3_TRANSFER_API DownloadRequest { +class AWS_S3_TRANSFER_API DownloadRequest final { public: - inline const Aws::S3::Model::GetObjectRequest& GetS3Request() const { return m_s3Request; } - inline bool S3RequestHasBeenSet() const { return m_s3RequestHasBeenSet; } - template - void SetS3Request(S3RequestT&& val) { - m_s3RequestHasBeenSet = true; - m_s3Request = std::forward(val); - } - template - DownloadRequest& WithS3Request(S3RequestT&& value) { - SetS3Request(std::forward(value)); - return *this; - } + explicit DownloadRequest( + Aws::S3::Model::GetObjectRequest s3Request, + Aws::String destinationFilePath, + Aws::IOStreamFactory responseStreamFactory, + Aws::Vector> transferListeners = {}) + : m_s3Request(std::move(s3Request)), + m_destinationFilePath(std::move(destinationFilePath)), + m_responseStreamFactory(std::move(responseStreamFactory)), + m_transferListeners(std::move(transferListeners)) {} + inline const Aws::S3::Model::GetObjectRequest& GetS3Request() const { return m_s3Request; } inline const Aws::String& GetDestinationFilePath() const { return m_destinationFilePath; } - inline bool DestinationFilePathHasBeenSet() const { return m_destinationFilePathHasBeenSet; } - template - void SetDestinationFilePath(DestinationFilePathT&& value) { - m_destinationFilePathHasBeenSet = true; - m_destinationFilePath = std::forward(value); - } - template - DownloadRequest& WithDestinationFilePath(DestinationFilePathT&& value) { - SetDestinationFilePath(std::forward(value)); - return *this; - } - - inline const Aws::IOStreamFactory& GetBody() const { return m_body; } - inline bool BodyHasBeenSet() const { return m_bodyHasBeenSet; } - inline void SetBody(const Aws::IOStreamFactory& val) { - m_bodyHasBeenSet = true; - m_body = val; - } - inline DownloadRequest& WithBody(const Aws::IOStreamFactory& val) { - SetBody(val); - return *this; - } - + inline const Aws::IOStreamFactory& GetResponseStreamFactory() const { return m_responseStreamFactory; } inline const Aws::Vector>& GetTransferListeners() const { return m_transferListeners; } - inline bool TransferListenersHasBeenSet() const { return m_transferListenersHasBeenSet; } - inline void SetTransferListeners(const Aws::Vector>& val) { - m_transferListenersHasBeenSet = true; - m_transferListeners = val; - } - inline DownloadRequest& WithTransferListeners(const Aws::Vector>& val) { - SetTransferListeners(val); - return *this; - } - inline DownloadRequest& AddTransferListener(const std::shared_ptr& listener) { - m_transferListenersHasBeenSet = true; - m_transferListeners.push_back(listener); - return *this; - } + private: Aws::S3::Model::GetObjectRequest m_s3Request; Aws::String m_destinationFilePath; - Aws::IOStreamFactory m_body; + Aws::IOStreamFactory m_responseStreamFactory; Aws::Vector> m_transferListeners; - bool m_s3RequestHasBeenSet = false; - bool m_destinationFilePathHasBeenSet = false; - bool m_bodyHasBeenSet = false; - bool m_transferListenersHasBeenSet = false; }; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h index 7ce3d3989c0c..ff36a9fc0254 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h @@ -19,7 +19,7 @@ namespace Transfer { * the underlying S3 GetObjectResult with whole-object content length and range, regardless * of how many ranged GETs were issued internally. */ -class AWS_S3_TRANSFER_API DownloadResponse { +class AWS_S3_TRANSFER_API DownloadResponse final { public: inline const Aws::S3::Model::GetObjectResult& GetS3Result() const { return m_s3Result; } inline bool S3ResultHasBeenSet() const { return m_s3ResultHasBeenSet; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h index 55d06bca7c84..52c5b03ae46d 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/S3TransferManager.h @@ -16,21 +16,17 @@ namespace Aws { class S3TransferManagerImpl; /** - * High-level S3 transfer client backed by the AWS Common Runtime. Performs single-file - * uploads and downloads, automatically using multipart transfers for objects larger than - * the configured threshold. Customers hold an instance via shared_ptr; the manager owns - * the underlying CRT client and is not copyable or movable. + * Customers construct an instance directly. The manager owns the underlying CRT + * client; it is movable but not copyable. */ - class AWS_S3_TRANSFER_API S3TransferManager: public std::enable_shared_from_this { + class AWS_S3_TRANSFER_API S3TransferManager final { public: - static std::shared_ptr Create(const S3TransferManagerConfiguration& config); - + explicit S3TransferManager(const S3TransferManagerConfiguration& config); ~S3TransferManager(); S3TransferManager(const S3TransferManager&) = delete; S3TransferManager& operator=(const S3TransferManager&) = delete; - S3TransferManager(S3TransferManager&&) = delete; - S3TransferManager& operator=(S3TransferManager&&) = delete; + /** * Begin uploading the object described by request. Returns immediately with a handle @@ -45,7 +41,6 @@ namespace Aws { DownloadHandle Download(const DownloadRequest& request); private: - explicit S3TransferManager(const S3TransferManagerConfiguration& config); Aws::UniquePtr m_impl; }; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h index 3cec44b7c34d..4780b2a926d6 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h @@ -19,14 +19,16 @@ class UploadHandleImpl; * Returned from S3TransferManager::Upload to represent a single in-flight upload. The * handle is freely copyable; all copies share the same underlying transfer state. */ -class AWS_S3_TRANSFER_API UploadHandle { +class AWS_S3_TRANSFER_API UploadHandle final { public: ~UploadHandle(); + UploadHandle(UploadHandle&&) noexcept; + UploadHandle& operator=(UploadHandle&&) noexcept; /** * Returns a future that resolves once the transfer finishes, succeeds, or fails. */ - std::shared_future CompletionFuture() const; + std::future CompletionFuture(); /** * Requests cancellation of the in-flight upload. Returns immediately; the future @@ -35,7 +37,7 @@ class AWS_S3_TRANSFER_API UploadHandle { void Cancel(); private: - std::shared_ptr m_impl; + std::unique_ptr m_impl; }; diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h index d180877c3e73..489b71f8c2a8 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h @@ -24,23 +24,23 @@ class AWS_S3_TRANSFER_API UploadProgressListener { /** * Invoked exactly once when the upload begins, before any bytes have been transferred. */ - virtual void OnTransferInitiated(const UploadRequest&, const UploadProgressSnapshot&) {} + virtual void OnTransferInitiated(const UploadRequest& /*request*/, const UploadProgressSnapshot& /*snapshot*/) {} /** * Invoked as bytes are submitted to S3. Called at least once for a successful transfer * and may be called many times depending on object size and I/O buffer sizes. */ - virtual void OnBytesTransferred(const UploadRequest&, const UploadProgressSnapshot&) {} + virtual void OnBytesTransferred(const UploadRequest& /*request*/, const UploadProgressSnapshot& /*snapshot*/) {} /** * Invoked exactly once when the upload completes successfully. */ - virtual void OnTransferComplete(const UploadRequest&, const UploadProgressSnapshot&) {} + virtual void OnTransferComplete(const UploadRequest& /*request*/, const UploadProgressSnapshot& /*snapshot*/) {} /** * Invoked exactly once when the upload fails or is cancelled. */ - virtual void OnTransferFailed(const UploadRequest&, const UploadProgressSnapshot&) {} + virtual void OnTransferFailed(const UploadRequest& /*request*/, const UploadProgressSnapshot& /*snapshot*/) {} }; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h index b7d63a90851f..185e5d99945b 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h @@ -17,7 +17,7 @@ namespace Transfer { * Immutable snapshot of upload progress passed to UploadProgressListener callbacks. Captures * bytes transferred, total bytes (known up-front for uploads), and the response once available. */ -class AWS_S3_TRANSFER_API UploadProgressSnapshot { +class AWS_S3_TRANSFER_API UploadProgressSnapshot final { public: UploadProgressSnapshot(uint64_t transferredBytes, uint64_t totalBytes, diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h index 1bb93d8cb8e9..b284a7bead1e 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadRequest.h @@ -21,72 +21,31 @@ namespace Transfer { * The transfer manager chooses between a single PutObject and a multipart upload based on * the configured threshold. */ -class AWS_S3_TRANSFER_API UploadRequest { +class AWS_S3_TRANSFER_API UploadRequest final { public: - inline const Aws::S3::Model::PutObjectRequest& GetS3Request() const { return m_s3Request; } - inline bool S3RequestHasBeenSet() const { return m_s3RequestHasBeenSet; } - template - void SetS3Request(S3RequestT&& val) { - m_s3RequestHasBeenSet = true; - m_s3Request = std::forward(val); - } - template - UploadRequest& WithS3Request(S3RequestT&& value) { - SetS3Request(std::forward(value)); - return *this; - } - - inline const Aws::String& GetSourceFilePath() const { return m_sourceFilePath; } - inline bool SourceFilePathHasBeenSet() const { return m_sourceFilePathHasBeenSet; } - template - void SetSourceFilePath(SourceFilePathT&& value) { - m_sourceFilePathHasBeenSet = true; - m_sourceFilePath = std::forward(value); - } - template - UploadRequest& WithSourceFilePath(SourceFilePathT&& value) { - SetSourceFilePath(std::forward(value)); - return *this; - } - - inline const std::shared_ptr& GetBody() const { return m_body; } - inline bool BodyHasBeenSet() const { return m_bodyHasBeenSet; } - inline void SetBody(const std::shared_ptr& val) { - m_bodyHasBeenSet = true; - m_body = val; - } - inline UploadRequest& WithBody(const std::shared_ptr& val) { - SetBody(val); - return *this; - } + explicit UploadRequest( + Aws::S3::Model::PutObjectRequest s3Request, + Aws::String sourceFilePath, + std::shared_ptr body, + Aws::Vector> transferListeners = {}) + : m_s3Request(std::move(s3Request)), + m_sourceFilePath(std::move(sourceFilePath)), + m_body(std::move(body)), + m_transferListeners(std::move(transferListeners)) {} + inline const Aws::S3::Model::PutObjectRequest& GetS3Request() const {return m_s3Request; } + inline const Aws::String& GetSourceFilePath() const {return m_sourceFilePath;} + inline const std::shared_ptr& GetBody() const {return m_body;} inline const Aws::Vector>& GetTransferListeners() const { return m_transferListeners; } - inline bool TransferListenersHasBeenSet() const { return m_transferListenersHasBeenSet; } - inline void SetTransferListeners(const Aws::Vector>& val) { - m_transferListenersHasBeenSet = true; - m_transferListeners = val; - } - inline UploadRequest& WithTransferListeners(const Aws::Vector>& val) { - SetTransferListeners(val); - return *this; - } - inline UploadRequest& AddTransferListener(const std::shared_ptr& listener) { - m_transferListenersHasBeenSet = true; - m_transferListeners.push_back(listener); - return *this; - } + private: Aws::S3::Model::PutObjectRequest m_s3Request; Aws::String m_sourceFilePath; std::shared_ptr m_body; Aws::Vector> m_transferListeners; - bool m_s3RequestHasBeenSet = false; - bool m_sourceFilePathHasBeenSet = false; - bool m_bodyHasBeenSet = false; - bool m_transferListenersHasBeenSet = false; }; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h index e09f73168fab..851d497171e7 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h @@ -19,7 +19,7 @@ namespace Transfer { * the underlying S3 PutObjectResult, populated from either the single PutObject response * or the CompleteMultipartUpload response depending on the path taken. */ -class AWS_S3_TRANSFER_API UploadResponse { +class AWS_S3_TRANSFER_API UploadResponse final { public: inline const Aws::S3::Model::PutObjectResult& GetS3Result() const { return m_s3Result; } inline bool S3ResultHasBeenSet() const { return m_s3ResultHasBeenSet; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h index 81e129f25b65..b45a188732f5 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/internal/CrtOperations.h @@ -18,11 +18,11 @@ class S3TransferManagerImpl; namespace Internal { /** - * Translates TM 2.0 request types into aws-c-s3 meta request options, dispatches - * the meta request, and routes CRT callbacks back into TM 2.0 listener events. - * Internal to the s3-transfer package; not part of the public API. - */ -class CrtOperations { + * Bridges TM 2.0 to the aws-crt-cpp S3 wrapper. Stays in C++; does not call + * aws-c-s3 directly. Internal; not part of the public API. + */ +class CrtOperations final { + public: /** * Dispatch an upload as a CRT meta request. Returns a handle bound to the diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp index d647b1590380..36e41721789c 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp @@ -11,8 +11,10 @@ }; DownloadHandle::~DownloadHandle() = default; + DownloadHandle::DownloadHandle(DownloadHandle&&) noexcept = default; + DownloadHandle& DownloadHandle::operator=(DownloadHandle&&) noexcept = default; - std::shared_future DownloadHandle::CompletionFuture() const { + std::future DownloadHandle::CompletionFuture() { return {}; } void DownloadHandle::Cancel() { diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp index 5b70e1ef1098..baf1d513aa5b 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/S3TransferManager.cpp @@ -18,13 +18,6 @@ m_impl(Aws::MakeUnique("S3TransferManager")) { } -std::shared_ptr S3TransferManager::Create(const S3TransferManagerConfiguration& config) { - struct MakeSharedEnabler : public S3TransferManager { - MakeSharedEnabler(const S3TransferManagerConfiguration& config) : S3TransferManager(config) {} - }; - return Aws::MakeShared("S3TransferManager", config); -} - UploadHandle S3TransferManager::Upload(const UploadRequest&) { return UploadHandle(); } diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp index aac8136bebe1..b2452a8a3432 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp @@ -11,8 +11,10 @@ }; UploadHandle::~UploadHandle() = default; + UploadHandle::UploadHandle(UploadHandle&&) noexcept = default; + UploadHandle& UploadHandle::operator=(UploadHandle&&) noexcept = default; - std::shared_future UploadHandle::CompletionFuture() const { + std::future UploadHandle::CompletionFuture() { return {}; } void UploadHandle::Cancel() { From 68a981efd7729482addbd47e17fd7d0f6e35a5d5 Mon Sep 17 00:00:00 2001 From: Vinay Narahari Date: Fri, 12 Jun 2026 11:04:46 -0400 Subject: [PATCH 6/7] TM Headers --- .../include/aws/s3-transfer/DownloadHandle.h | 1 + .../s3-transfer/DownloadProgressListener.h | 30 ++---------- .../s3-transfer/DownloadProgressSnapshot.h | 28 ++--------- .../aws/s3-transfer/DownloadResponse.h | 2 +- .../aws/s3-transfer/ProgressListener.h | 47 ++++++++++++++++++ .../aws/s3-transfer/ProgressSnapshot.h | 49 +++++++++++++++++++ .../include/aws/s3-transfer/UploadHandle.h | 2 + .../aws/s3-transfer/UploadProgressListener.h | 30 ++---------- .../aws/s3-transfer/UploadProgressSnapshot.h | 27 ++-------- .../include/aws/s3-transfer/UploadResponse.h | 2 +- .../source/s3-transfer/DownloadHandle.cpp | 1 + .../source/s3-transfer/UploadHandle.cpp | 2 + 12 files changed, 118 insertions(+), 103 deletions(-) create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h create mode 100644 src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h index 1f01af727f6e..c73dc3f91a6e 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h @@ -21,6 +21,7 @@ class DownloadHandleImpl; */ class AWS_S3_TRANSFER_API DownloadHandle final { public: + DownloadHandle(); ~DownloadHandle(); DownloadHandle(DownloadHandle&&) noexcept; DownloadHandle& operator=(DownloadHandle&&) noexcept; diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h index 74029d441f27..6e5f2a9a378e 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressListener.h @@ -4,44 +4,22 @@ */ #pragma once #include +#include +#include namespace Aws { namespace S3 { namespace Transfer { class DownloadRequest; -class DownloadProgressSnapshot; /** * Callback interface for receiving event-driven updates throughout the lifecycle of a download. * Subclass and override the events of interest; default implementations are empty so unused * callbacks can be ignored. Listeners may be registered on the request or on the manager. */ -class AWS_S3_TRANSFER_API DownloadProgressListener { - public: - virtual ~DownloadProgressListener() = default; - - /** - * Invoked exactly once when the download begins, before any bytes have been transferred. - */ - virtual void OnTransferInitiated(const DownloadRequest& /*request*/, const DownloadProgressSnapshot& /*snapshot*/) {} - - /** - * Invoked as bytes are received from S3. Called at least once for a successful transfer - * and may be called many times depending on object size and I/O buffer sizes. - */ - virtual void OnBytesTransferred(const DownloadRequest& /*request*/, const DownloadProgressSnapshot& /*snapshot*/) {} - - /** - * Invoked exactly once when the download completes successfully. - */ - virtual void OnTransferComplete(const DownloadRequest& /*request*/, const DownloadProgressSnapshot& /*snapshot*/) {} - - /** - * Invoked exactly once when the download fails or is cancelled. - */ - virtual void OnTransferFailed(const DownloadRequest& /*request*/, const DownloadProgressSnapshot& /*snapshot*/) {} -}; +class AWS_S3_TRANSFER_API DownloadProgressListener + : public ProgressListener {}; } } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h index 8911d6cc06b0..2e0791a9e0ac 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadProgressSnapshot.h @@ -4,10 +4,8 @@ */ #pragma once #include +#include #include -#include -#include -#include namespace Aws { namespace S3 { @@ -18,29 +16,9 @@ namespace Transfer { * Captures bytes transferred, total bytes (known after the GetObject response is received), * and the response once available. */ - -class AWS_S3_TRANSFER_API DownloadProgressSnapshot final { +class AWS_S3_TRANSFER_API DownloadProgressSnapshot final : public ProgressSnapshot { public: - DownloadProgressSnapshot(uint64_t transferredBytes, - uint64_t totalBytes, - std::shared_ptr response, - bool totalBytesHasBeenSet) - : m_transferredBytes(transferredBytes), - m_totalBytes(totalBytes), - m_response(std::move(response)), - m_totalBytesHasBeenSet(totalBytesHasBeenSet) {} - - inline uint64_t GetTransferredBytes() const { return m_transferredBytes; } - inline uint64_t GetTotalBytes() const { return m_totalBytes; } - inline bool TotalBytesHasBeenSet() const { return m_totalBytesHasBeenSet; } - inline const std::shared_ptr& GetResponse() const { return m_response; } - inline bool ResponseHasBeenSet() const { return m_response != nullptr; } - - private: - uint64_t m_transferredBytes = 0; - uint64_t m_totalBytes = 0; - std::shared_ptr m_response; - bool m_totalBytesHasBeenSet = false; + using ProgressSnapshot::ProgressSnapshot; }; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h index ff36a9fc0254..8aa84699b287 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadResponse.h @@ -39,7 +39,7 @@ class AWS_S3_TRANSFER_API DownloadResponse final { bool m_s3ResultHasBeenSet = false; }; -typedef Aws::Utils::Outcome> DownloadOutcome; +using DownloadOutcome = Aws::Utils::Outcome>; } } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h new file mode 100644 index 000000000000..d345f10242b7 --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressListener.h @@ -0,0 +1,47 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include + +namespace Aws { +namespace S3 { +namespace Transfer { + +/** + * Callback interface for receiving event-driven updates throughout the lifecycle of a transfer. + * Subclass and override the events of interest; default implementations are empty so unused + * callbacks can be ignored. Listeners may be registered on the request or on the manager. + * Specialized via the UploadProgressListener and DownloadProgressListener type aliases. + */ +template +class ProgressListener { + public: + virtual ~ProgressListener() = default; + + /** + * Invoked exactly once when the transfer begins, before any bytes have been transferred. + */ + virtual void OnTransferInitiated(const RequestT& /*request*/, const SnapshotT& /*snapshot*/) {} + + /** + * Invoked as bytes are transferred. Called at least once for a successful transfer + * and may be called many times depending on object size and I/O buffer sizes. + */ + virtual void OnBytesTransferred(const RequestT& /*request*/, const SnapshotT& /*snapshot*/) {} + + /** + * Invoked exactly once when the transfer completes successfully. + */ + virtual void OnTransferComplete(const RequestT& /*request*/, const SnapshotT& /*snapshot*/) {} + + /** + * Invoked exactly once when the transfer fails or is cancelled. + */ + virtual void OnTransferFailed(const RequestT& /*request*/, const SnapshotT& /*snapshot*/) {} +}; + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h new file mode 100644 index 000000000000..18ef7898d85b --- /dev/null +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/ProgressSnapshot.h @@ -0,0 +1,49 @@ +/** + * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. + * SPDX-License-Identifier: Apache-2.0. + */ +#pragma once +#include +#include +#include +#include + +namespace Aws { +namespace S3 { +namespace Transfer { + +/** + * Immutable snapshot of transfer progress passed to ProgressListener callbacks. Captures + * bytes transferred, total bytes, and the response once available. Specialized via the + * UploadProgressSnapshot and DownloadProgressSnapshot type aliases. + */ +template +class ProgressSnapshot { + public: + virtual ~ProgressSnapshot() = default; + + ProgressSnapshot(uint64_t transferredBytes, + uint64_t totalBytes, + std::shared_ptr response, + bool totalBytesHasBeenSet) + : m_transferredBytes(transferredBytes), + m_totalBytes(totalBytes), + m_response(std::move(response)), + m_totalBytesHasBeenSet(totalBytesHasBeenSet) {} + + inline uint64_t GetTransferredBytes() const { return m_transferredBytes; } + inline uint64_t GetTotalBytes() const { return m_totalBytes; } + inline bool TotalBytesHasBeenSet() const { return m_totalBytesHasBeenSet; } + inline const std::shared_ptr& GetResponse() const { return m_response; } + inline bool ResponseHasBeenSet() const { return m_response != nullptr; } + + private: + uint64_t m_transferredBytes = 0; + uint64_t m_totalBytes = 0; + std::shared_ptr m_response; + bool m_totalBytesHasBeenSet = false; +}; + +} +} +} diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h index 4780b2a926d6..9610ac44089a 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h @@ -21,10 +21,12 @@ class UploadHandleImpl; */ class AWS_S3_TRANSFER_API UploadHandle final { public: + UploadHandle(); ~UploadHandle(); UploadHandle(UploadHandle&&) noexcept; UploadHandle& operator=(UploadHandle&&) noexcept; + /** * Returns a future that resolves once the transfer finishes, succeeds, or fails. */ diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h index 489b71f8c2a8..dc0189304419 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressListener.h @@ -4,44 +4,22 @@ */ #pragma once #include +#include +#include namespace Aws { namespace S3 { namespace Transfer { class UploadRequest; -class UploadProgressSnapshot; /** * Callback interface for receiving event-driven updates throughout the lifecycle of an upload. * Subclass and override the events of interest; default implementations are empty so unused * callbacks can be ignored. Listeners may be registered on the request or on the manager. */ -class AWS_S3_TRANSFER_API UploadProgressListener { - public: - virtual ~UploadProgressListener() = default; - - /** - * Invoked exactly once when the upload begins, before any bytes have been transferred. - */ - virtual void OnTransferInitiated(const UploadRequest& /*request*/, const UploadProgressSnapshot& /*snapshot*/) {} - - /** - * Invoked as bytes are submitted to S3. Called at least once for a successful transfer - * and may be called many times depending on object size and I/O buffer sizes. - */ - virtual void OnBytesTransferred(const UploadRequest& /*request*/, const UploadProgressSnapshot& /*snapshot*/) {} - - /** - * Invoked exactly once when the upload completes successfully. - */ - virtual void OnTransferComplete(const UploadRequest& /*request*/, const UploadProgressSnapshot& /*snapshot*/) {} - - /** - * Invoked exactly once when the upload fails or is cancelled. - */ - virtual void OnTransferFailed(const UploadRequest& /*request*/, const UploadProgressSnapshot& /*snapshot*/) {} -}; +class AWS_S3_TRANSFER_API UploadProgressListener + : public ProgressListener {}; } } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h index 185e5d99945b..430b40dca974 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadProgressSnapshot.h @@ -4,10 +4,8 @@ */ #pragma once #include +#include #include -#include -#include -#include namespace Aws { namespace S3 { @@ -17,28 +15,9 @@ namespace Transfer { * Immutable snapshot of upload progress passed to UploadProgressListener callbacks. Captures * bytes transferred, total bytes (known up-front for uploads), and the response once available. */ -class AWS_S3_TRANSFER_API UploadProgressSnapshot final { +class AWS_S3_TRANSFER_API UploadProgressSnapshot final : public ProgressSnapshot { public: - UploadProgressSnapshot(uint64_t transferredBytes, - uint64_t totalBytes, - std::shared_ptr response, - bool totalBytesHasBeenSet) - : m_transferredBytes(transferredBytes), - m_totalBytes(totalBytes), - m_response(std::move(response)), - m_totalBytesHasBeenSet(totalBytesHasBeenSet) {} - - inline uint64_t GetTransferredBytes() const { return m_transferredBytes; } - inline uint64_t GetTotalBytes() const { return m_totalBytes; } - inline bool TotalBytesHasBeenSet() const { return m_totalBytesHasBeenSet; } - inline const std::shared_ptr& GetResponse() const { return m_response; } - inline bool ResponseHasBeenSet() const { return m_response != nullptr; } - - private: - uint64_t m_transferredBytes = 0; - uint64_t m_totalBytes = 0; - std::shared_ptr m_response; - bool m_totalBytesHasBeenSet = false; + using ProgressSnapshot::ProgressSnapshot; }; } diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h index 851d497171e7..e5618229defc 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadResponse.h @@ -39,7 +39,7 @@ class AWS_S3_TRANSFER_API UploadResponse final { bool m_s3ResultHasBeenSet = false; }; -typedef Aws::Utils::Outcome> UploadOutcome; +using UploadOutcome = Aws::Utils::Outcome>; } } diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp index 36e41721789c..e8189b20e69d 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/DownloadHandle.cpp @@ -11,6 +11,7 @@ }; DownloadHandle::~DownloadHandle() = default; + DownloadHandle::DownloadHandle() = default; DownloadHandle::DownloadHandle(DownloadHandle&&) noexcept = default; DownloadHandle& DownloadHandle::operator=(DownloadHandle&&) noexcept = default; diff --git a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp index b2452a8a3432..2d46c4d976a5 100644 --- a/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp +++ b/src/aws-cpp-sdk-s3-transfer/source/s3-transfer/UploadHandle.cpp @@ -11,6 +11,8 @@ }; UploadHandle::~UploadHandle() = default; + UploadHandle::UploadHandle() = default; + UploadHandle::UploadHandle(UploadHandle&&) noexcept = default; UploadHandle& UploadHandle::operator=(UploadHandle&&) noexcept = default; From 1894839fd33e890171e1c305dc3f2c552e898470 Mon Sep 17 00:00:00 2001 From: Vinay Narahari Date: Fri, 12 Jun 2026 11:14:09 -0400 Subject: [PATCH 7/7] TM Headers -minor fix --- .../include/aws/s3-transfer/DownloadHandle.h | 2 +- .../include/aws/s3-transfer/UploadHandle.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h index c73dc3f91a6e..895f813cb0e9 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/DownloadHandle.h @@ -38,7 +38,7 @@ class AWS_S3_TRANSFER_API DownloadHandle final { void Cancel(); private: - std::unique_ptr m_impl; + Aws::UniquePtr m_impl; }; diff --git a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h index 9610ac44089a..5e6b893a96de 100644 --- a/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h +++ b/src/aws-cpp-sdk-s3-transfer/include/aws/s3-transfer/UploadHandle.h @@ -39,7 +39,7 @@ class AWS_S3_TRANSFER_API UploadHandle final { void Cancel(); private: - std::unique_ptr m_impl; + Aws::UniquePtr m_impl; };