AWS SDK for C++

AWS SDK for C++ Version 1.11.440

Loading...
Searching...
No Matches
Public Member Functions | Static Public Member Functions | Static Protected Member Functions | List of all members
Aws::Transfer::TransferManager Class Reference

#include <TransferManager.h>

Inheritance diagram for Aws::Transfer::TransferManager:
[legend]

Public Member Functions

TransferStatus WaitUntilAllFinished (int64_t timeoutMs=std::numeric_limits< int64_t >::max())
 
void CancelAll ()
 
 
std::shared_ptr< TransferHandleUploadFile (const Aws::String &fileName, const Aws::String &bucketName, const Aws::String &keyName, const Aws::String &contentType, const Aws::Map< Aws::String, Aws::String > &metadata, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr)
 
std::shared_ptr< TransferHandleUploadFile (const std::shared_ptr< Aws::IOStream > &stream, const Aws::String &bucketName, const Aws::String &keyName, const Aws::String &contentType, const Aws::Map< Aws::String, Aws::String > &metadata, const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr)
 
std::shared_ptr< TransferHandleDownloadFile (const Aws::String &bucketName, const Aws::String &keyName, const Aws::String &writeToFile, const DownloadConfiguration &downloadConfig=DownloadConfiguration(), const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr)
 
std::shared_ptr< TransferHandleDownloadFile (const Aws::String &bucketName, const Aws::String &keyName, CreateDownloadStreamCallback writeToStreamfn, const DownloadConfiguration &downloadConfig=DownloadConfiguration(), const Aws::String &writeToFile="", const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr)
 
std::shared_ptr< TransferHandleDownloadFile (const Aws::String &bucketName, const Aws::String &keyName, uint64_t fileOffset, uint64_t downloadBytes, CreateDownloadStreamCallback writeToStreamfn, const DownloadConfiguration &downloadConfig=DownloadConfiguration(), const Aws::String &writeToFile="", const std::shared_ptr< const Aws::Client::AsyncCallerContext > &context=nullptr)
 
std::shared_ptr< TransferHandleRetryDownload (const std::shared_ptr< TransferHandle > &retryHandle)
 
std::shared_ptr< TransferHandleRetryUpload (const Aws::String &fileName, const std::shared_ptr< TransferHandle > &retryHandle)
 
std::shared_ptr< TransferHandleRetryUpload (const std::shared_ptr< Aws::IOStream > &stream, const std::shared_ptr< TransferHandle > &retryHandle)
 
void AbortMultipartUpload (const std::shared_ptr< TransferHandle > &inProgressHandle)
 
void UploadDirectory (const Aws::String &directory, const Aws::String &bucketName, const Aws::String &prefix, const Aws::Map< Aws::String, Aws::String > &metadata)
 
void DownloadToDirectory (const Aws::String &directory, const Aws::String &bucketName, const Aws::String &prefix=Aws::String())
 

Static Public Member Functions

static std::shared_ptr< TransferManagerCreate (const TransferManagerConfiguration &config)
 

Static Protected Member Functions

static bool IsWithinParentDirectory (Aws::String parentDirectory, Aws::String filePath)
 

Detailed Description

This is a utility around Amazon Simple Storage Service. It can Upload large files via parts in parallel, Upload files less than 5MB in single PutObject, and download files via GetObject, If a transfer fails, it can be retried for an upload. For a download, there is nothing to retry in case of failure. Just download it again. You can also abort any in progress transfers. The key interface for controlling and knowing the status of your upload is the TransferHandle. An instance of TransferHandle is returned from each of the public functions in this interface. Keep a reference to the pointer. Each of the callbacks will also pass the handle that has received an update. None of the public methods in this interface block.

Definition at line 157 of file TransferManager.h.

Constructor & Destructor Documentation

◆ ~TransferManager()

Aws::Transfer::TransferManager::~TransferManager ( )

Member Function Documentation

◆ AbortMultipartUpload()

void Aws::Transfer::TransferManager::AbortMultipartUpload ( const std::shared_ptr< TransferHandle > &  inProgressHandle)

By default, multi-part uploads will remain in a FAILED state if they fail, or a CANCELED state if they were canceled. Leaving failed uploads around still costs the owner of the bucket money. If you know you will not be retrying the request, abort the request after canceling it or if it fails and you don't intend to retry it.

◆ CancelAll()

void Aws::Transfer::TransferManager::CancelAll ( )

Cancels all TransferManager operations in the current context of the TransferManager. Non-blocking, please call WaitUntilAllFinished method if ShutdownAPI() is going to follow.

◆ Create()

static std::shared_ptr< TransferManager > Aws::Transfer::TransferManager::Create ( const TransferManagerConfiguration config)
static

Create a new TransferManager instance initialized with config.

◆ DownloadFile() [1/3]

std::shared_ptr< TransferHandle > Aws::Transfer::TransferManager::DownloadFile ( const Aws::String bucketName,
const Aws::String keyName,
const Aws::String writeToFile,
const DownloadConfiguration downloadConfig = DownloadConfiguration(),
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
)

Downloads the contents of bucketName/keyName in S3 to the file specified by writeToFile. This will perform a GetObject operation.

◆ DownloadFile() [2/3]

std::shared_ptr< TransferHandle > Aws::Transfer::TransferManager::DownloadFile ( const Aws::String bucketName,
const Aws::String keyName,
CreateDownloadStreamCallback  writeToStreamfn,
const DownloadConfiguration downloadConfig = DownloadConfiguration(),
const Aws::String writeToFile = "",
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
)

Downloads the contents of bucketName/keyName in S3 and writes it to writeToStream. This will perform a GetObject operation.

◆ DownloadFile() [3/3]

std::shared_ptr< TransferHandle > Aws::Transfer::TransferManager::DownloadFile ( const Aws::String bucketName,
const Aws::String keyName,
uint64_t  fileOffset,
uint64_t  downloadBytes,
CreateDownloadStreamCallback  writeToStreamfn,
const DownloadConfiguration downloadConfig = DownloadConfiguration(),
const Aws::String writeToFile = "",
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
)

Downloads the contents of bucketName/keyName in S3 and writes it to writeToStream. This will perform a GetObject operation for the given range.

◆ DownloadToDirectory()

void Aws::Transfer::TransferManager::DownloadToDirectory ( const Aws::String directory,
const Aws::String bucketName,
const Aws::String prefix = Aws::String() 
)

Downloads entire contents of an Amazon S3 bucket starting at prefix stores them in a directory (not including the prefix). This is an asynchronous method. You will receive notifications that a download has started via the transferInitiatedCallback callback function in your configuration. If you do not set this callback, then you will not be able to handle the file transfers. If an error occurs prior to the transfer being initiated (e.g. list objects fails, then an error will be passed through the errorCallback).

directory: the absolute directory on disk to download to bucketName: the name of the S3 bucket to download from prefix: the prefix in the bucket to use as the root directory (e.g. download all objects at x prefix in S3 and then store them starting in directory with the prefix stripped out).

◆ IsWithinParentDirectory()

static bool Aws::Transfer::TransferManager::IsWithinParentDirectory ( Aws::String  parentDirectory,
Aws::String  filePath 
)
staticprotected

◆ RetryDownload()

std::shared_ptr< TransferHandle > Aws::Transfer::TransferManager::RetryDownload ( const std::shared_ptr< TransferHandle > &  retryHandle)

Retry an download that failed from a previous DownloadFile operation. If a multi-part download was used, only the failed parts will be re-fetched.

◆ RetryUpload() [1/2]

std::shared_ptr< TransferHandle > Aws::Transfer::TransferManager::RetryUpload ( const Aws::String fileName,
const std::shared_ptr< TransferHandle > &  retryHandle 
)

Retry an upload that failed from a previous UploadFile operation. If a multi-part upload was used, only the failed parts will be re-sent.

◆ RetryUpload() [2/2]

std::shared_ptr< TransferHandle > Aws::Transfer::TransferManager::RetryUpload ( const std::shared_ptr< Aws::IOStream > &  stream,
const std::shared_ptr< TransferHandle > &  retryHandle 
)

Retry an upload that failed from a previous UploadFile operation. If a multi-part upload was used, only the failed parts will be re-sent.

◆ UploadDirectory()

void Aws::Transfer::TransferManager::UploadDirectory ( const Aws::String directory,
const Aws::String bucketName,
const Aws::String prefix,
const Aws::Map< Aws::String, Aws::String > &  metadata 
)

Uploads entire contents of directory to Amazon S3 bucket and stores them in a directory starting at prefix. This is an asynchronous method. You will receive notifications that an upload has started via the transferInitiatedCallback callback function in your configuration. If you do not set this callback, then you will not be able to handle the file transfers.

directory: the absolute directory on disk to upload bucketName: the name of the S3 bucket to upload to prefix: the prefix to put on all objects uploaded (e.g. put them in x directory in the bucket).

◆ UploadFile() [1/2]

std::shared_ptr< TransferHandle > Aws::Transfer::TransferManager::UploadFile ( const Aws::String fileName,
const Aws::String bucketName,
const Aws::String keyName,
const Aws::String contentType,
const Aws::Map< Aws::String, Aws::String > &  metadata,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
)

Uploads a file via filename, to bucketName/keyName in S3. contentType and metadata will be added to the object. If the object is larger than the configured bufferSize, then a multi-part upload will be performed. Keeps file to be unopened until doing actual upload, this is useful for uploading directories with many small files (avoid having too many open files, which may exceed system limit)

◆ UploadFile() [2/2]

std::shared_ptr< TransferHandle > Aws::Transfer::TransferManager::UploadFile ( const std::shared_ptr< Aws::IOStream > &  stream,
const Aws::String bucketName,
const Aws::String keyName,
const Aws::String contentType,
const Aws::Map< Aws::String, Aws::String > &  metadata,
const std::shared_ptr< const Aws::Client::AsyncCallerContext > &  context = nullptr 
)

Uploads the contents of stream, to bucketName/keyName in S3. contentType and metadata will be added to the object. If the object is larger than the configured bufferSize, then a multi-part upload will be performed.

◆ WaitUntilAllFinished()

TransferStatus Aws::Transfer::TransferManager::WaitUntilAllFinished ( int64_t  timeoutMs = std::numeric_limits< int64_t >::max())

Blocks the calling thread until all this instance TransferManager operations have finished.

TransferManager API may outlive InitAPI{...}ShutdownAPI scope if TransferHandle status were not completed. Use this method before ShutdownAPI call if individual TransferHandles are not verified for completion.

Parameters
timeoutMs,howmany milliseconds to block wait
Returns
COMPLETED if all tasks are finished, IN_PROGRESS if timeoutMs was reached.

The documentation for this class was generated from the following file: