|
aws-crt-cpp
C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++.
|
#include <S3.h>
Classes | |
| struct | Impl |
Public Types | |
| using | BodyCallback = std::function< bool(ByteCursor body, uint64_t rangeStart)> |
| using | BodyCallbackEx = std::function< bool(ByteCursor body, uint64_t rangeStart, S3BufferTicket &ticket)> |
| using | HeadersCallback = std::function< bool(const Vector< Http::HttpHeader > &headers, int responseStatus)> |
| using | ProgressCallback = std::function< void(uint64_t bytesTransferred, uint64_t contentLength)> |
| using | FinishCallback = std::function< void(const S3MetaRequestResult &result)> |
| using | ShutdownCallback = std::function< void()> |
Protected Member Functions | |
| S3MetaRequestOptions (S3MetaRequestType type, const std::shared_ptr< Http::HttpRequest > &request) noexcept | |
Protected Attributes | |
| ScopedResource< Impl > | m_impl |
| std::shared_ptr< Http::HttpRequest > | m_httpRequest |
| String | m_operationName |
| String | m_sendFilepath |
| String | m_recvFilepath |
| aws_uri | m_endpoint |
| bool | m_endpointInit |
| Optional< uint64_t > | m_objectSizeHint |
| BodyCallback | m_bodyCb |
| BodyCallbackEx | m_bodyCbEx |
| HeadersCallback | m_headersCb |
| ProgressCallback | m_progressCb |
| FinishCallback | m_finishCb |
| ShutdownCallback | m_shutdownCb |
| int | m_lastError = AWS_ERROR_SUCCESS |
Abstract base for the four concrete options types. Users obtain a unique_ptr through the subclass's static Create factory (some subclasses overload Create so the body sink or source is chosen by argument type), then set cross-cutting fields on the base through the shared Set* setters before handing the object to S3Client::MakeMetaRequest.
Mutual exclusion of body-delivery paths (callback / callback_ex / recv_filepath) is enforced structurally by the factory shapes.
| using Aws::Crt::S3::S3MetaRequestOptions::BodyCallback = std::function<bool(ByteCursor body, uint64_t rangeStart)> |
Invoked once per delivered body chunk during a download.
| body | the chunk of object bytes for this delivery. |
| rangeStart | byte offset within the object that this chunk starts at. |
| using Aws::Crt::S3::S3MetaRequestOptions::BodyCallbackEx = std::function<bool(ByteCursor body, uint64_t rangeStart, S3BufferTicket &ticket)> |
Like BodyCallback, but the chunk is delivered with a borrowed S3BufferTicket. The receiver may call ticket.Acquire() to extend the buffer's lifetime past the callback return for zero-copy consumption.
| body | the chunk of object bytes for this delivery. |
| rangeStart | byte offset within the object that this chunk starts at. |
| ticket | borrowed handle to the CRT-owned buffer holding body. |
| using Aws::Crt::S3::S3MetaRequestOptions::FinishCallback = std::function<void(const S3MetaRequestResult &result)> |
Invoked once when the meta request terminates (success or failure).
| result | final state of the meta request, including error code, HTTP status, and (on failure) the S3 error response headers and body. The error response body is a borrowed cursor into CRT-owned memory, valid only for the duration of this callback; copy it out if you need it. |
| using Aws::Crt::S3::S3MetaRequestOptions::HeadersCallback = std::function<bool(const Vector<Http::HttpHeader> &headers, int responseStatus)> |
Invoked once when response headers are available.
| headers | materialized snapshot of the response headers. |
| responseStatus | HTTP status code from the response. |
| using Aws::Crt::S3::S3MetaRequestOptions::ProgressCallback = std::function<void(uint64_t bytesTransferred, uint64_t contentLength)> |
Invoked periodically as bytes flow.
| bytesTransferred | number of bytes since the last invocation. |
| contentLength | total length of the transfer in bytes, if known. |
| using Aws::Crt::S3::S3MetaRequestOptions::ShutdownCallback = std::function<void()> |
Invoked after the CRT has fully torn down the meta request and will not invoke any further callbacks. The right place to free any heap state that the callbacks depended on.
|
delete |
|
delete |
|
virtualnoexcept |
|
protectednoexcept |
Protected ctor. Only invocable by subclasses. Allocates the C options struct, sets its type and message, and retains a shared reference to the HTTP request so the underlying aws_http_message stays alive for the meta request's lifetime.
| type | the operation the CRT should orchestrate. |
| request | the prepared HTTP request. |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
inlinenoexcept |
|
delete |
|
delete |
|
noexcept |
Set the checksum configuration for this meta request.
| config | the checksum configuration. |
|
noexcept |
Set a per-request endpoint override. Overrides the scheme and port the meta request would otherwise derive from the HTTP request. If the HTTP request already carries a Host header it must match this endpoint's authority, otherwise MakeMetaRequest fails. The options object owns a parsed copy of the URI for its lifetime. An invalid endpoint URI is recorded and causes MakeMetaRequest to fail with the parse error, rather than being silently ignored.
| endpoint | the endpoint URI to use for this meta request. |
|
noexcept |
Install the finish callback. Invoked once when the meta request terminates.
| cb | the callback to invoke on completion or failure. |
|
noexcept |
Install the response-headers callback.
| cb | the callback to invoke when response headers arrive. |
|
noexcept |
Override the client-level multipart-upload threshold for just this meta request. Same semantics as S3ClientConfig::SetMultipartUploadThreshold. 0 means inherit from the client.
| bytes | threshold in bytes. |
|
noexcept |
Hint the size of the object being uploaded or downloaded. Used by the CRT to pick a strategy and validate part counts without an extra HeadObject roundtrip. Pass 0 to clear.
| bytes | known object size in bytes; 0 to clear. |
|
noexcept |
Override the client-level target part size for just this meta request. Same semantics as S3ClientConfig::SetPartSize. 0 means inherit from the client.
| bytes | target part size in bytes. |
|
noexcept |
Install the progress callback.
| cb | the callback to invoke as bytes flow. |
|
noexcept |
Delete the receive file if the meta request fails. Off by default; the file is left as-is on failure. Useful when the caller wants the CRT to clean up its own temp file rather than doing the delete after the finish callback.
| deleteOnFailure | whether to delete the file on failure. |
|
noexcept |
Choose how the destination file supplied to a receive-to-file factory is opened. Defaults to CreateOrReplace. Ignored when the meta request has no receive filepath (i.e. a callback sink).
| mode | the file-open policy. |
|
noexcept |
Set the byte offset the CRT writes at when the recv file mode is WriteToPosition. Ignored otherwise.
| position | byte offset within the file. |
|
noexcept |
Install the shutdown callback. Invoked after the CRT has fully torn down the meta request; the safe point to free callback state.
| cb | the callback to invoke after final teardown. |
|
noexcept |
Override the client-level signing config for this meta request.
Only the underlying handle is borrowed; no copy is taken (AwsSigningConfig is non-copyable). The supplied config must outlive the call that consumes it - S3Client::MakeMetaRequest, which deep-copies the signing config internally.
| config | the SigV4 signing config to use for this request. |
|
noexcept |
Configure this meta request's signing from a resolved endpoint's auth scheme. The config is owned by this options object. Prefer this over SetSigningConfig for endpoint-resolved signing, since the S3Express algorithm is not expressible via the public SigningAlgorithm enum.
| region | the client region, used as the signing-config base. |
| signingRegion | signing region from the auth scheme, or empty to keep region. |
| signingName | signing service name from the auth scheme, or empty to keep "s3". |
| isS3Express | true for a directory bucket (use V4-S3Express); false for SigV4. |
| provider | the credentials provider used during signing. Required; a null provider is recorded as an error and fails MakeMetaRequest. |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
1.8.10