AWS SDK for C++

AWS SDK for C++ Version 1.11.867

Loading...
Searching...
No Matches
TransferState.h
1
5#pragma once
6
7#include <aws/s3-transfer/S3Transfer_EXPORTS.h>
8#include <aws/s3-transfer/UploadRequest.h>
9#include <aws/s3-transfer/UploadResponse.h>
10#include <aws/s3-transfer/DownloadRequest.h>
11#include <aws/s3-transfer/DownloadResponse.h>
12#include <aws/core/Core_EXPORTS.h>
13#include <aws/core/utils/memory/stl/AWSString.h>
14#include <aws/core/http/HttpTypes.h>
15#include <aws/crt/Optional.h>
16#include <atomic>
17#include <cstdint>
18#include <future>
19#include <memory>
20
21namespace Aws {
22namespace S3 {
23namespace Transfer {
24
25// Per-transfer state shared by the CRT callbacks and the customer's handle. The promise is
26// fulfilled exactly once, inside the finish callback. The meta request deliberately lives on the
27// handle instead (see HandleImpls.h): with nothing here pointing back at it, the callbacks can hold
28// this state by shared_ptr, and a transfer outlives a handle the customer dropped.
29template <typename RequestT, typename OutcomeT>
30struct AWS_CORE_LOCAL TransferStateBase {
31 std::promise<OutcomeT> promise;
32 RequestT request;
33 Aws::Crt::Optional<uint64_t> totalBytes;
34 std::atomic<uint64_t> transferredBytes{0};
36 int responseStatus = 0;
37
38 explicit TransferStateBase(RequestT req) : request(std::move(req)) {}
39 virtual ~TransferStateBase() = default;
40
45};
46
47struct AWS_CORE_LOCAL UploadTransferState final : TransferStateBase<UploadRequest, UploadOutcome> {
48 using TransferStateBase::TransferStateBase;
49};
50
51struct AWS_CORE_LOCAL DownloadTransferState final : TransferStateBase<DownloadRequest, DownloadOutcome> {
52 using TransferStateBase::TransferStateBase;
53};
54
55} // namespace Transfer
56} // namespace S3
57} // namespace Aws
Aws::Map< Aws::String, Aws::String > HeaderValueCollection
Aws::Http::HeaderValueCollection responseHeaders
TransferStateBase(const TransferStateBase &)=delete
std::promise< OutcomeT > promise
Aws::Crt::Optional< uint64_t > totalBytes
TransferStateBase & operator=(const TransferStateBase &)=delete
TransferStateBase(TransferStateBase &&)=delete
TransferStateBase & operator=(TransferStateBase &&)=delete