in sample/src/encryption/EncryptionSample.cc [161:207]
void EncryptionSample::DownloadObjectProcess()
{
//case 1: no checkpoint dir is coinfig
{
DownloadObjectRequest request(bucket_, "DownloadObjectProgress", Config::FileDownloadTo);
TransferProgress progressCallback = { ProgressCallback , this };
request.setTransferProgress(progressCallback);
auto outcome = client->ResumableDownloadObject(request);
if (outcome.isSuccess()) {
std::cout << __FUNCTION__ << "[" << this << "]" << " success, ETag:" << outcome.result().Metadata().ETag() << std::endl;
}
else {
PrintError(__FUNCTION__, outcome.error());
}
}
//case 2: checkpoint dir is config
{
DownloadObjectRequest request(bucket_, "DownloadObjectProgress", Config::FileDownloadTo, Config::CheckpointDir);
TransferProgress progressCallback = { ProgressCallback , this };
request.setTransferProgress(progressCallback);
auto outcome = client->ResumableDownloadObject(request);
if (outcome.isSuccess()) {
std::cout << __FUNCTION__ << "[" << this << "]" << " success, ETag:" << outcome.result().Metadata().ETag() << std::endl;
}
else {
PrintError(__FUNCTION__, outcome.error());
}
}
//case 3: checkpoint dir is config, multi threads is config
{
DownloadObjectRequest request(bucket_, "DownloadObjectProgress", Config::FileDownloadTo, Config::CheckpointDir, DefaultPartSize, 4);
TransferProgress progressCallback = { ProgressCallback , this };
request.setTransferProgress(progressCallback);
auto outcome = client->ResumableDownloadObject(request);
if (outcome.isSuccess()) {
std::cout << __FUNCTION__ << "[" << this << "]" << " success, ETag:" << outcome.result().Metadata().ETag() << std::endl;
}
else {
PrintError(__FUNCTION__, outcome.error());
}
}
}