[Storage Blobs Service] Rename Results and Options (#460)
* rename UploadFrom
* Rename CommitBlockListResult/Options GetBlockListResult/Options
* Rename DownloadBlobTo{Options/Result} UploadBlockBlobFrom{Options/Result}
This commit is contained in:
parent
86a22901e9
commit
24959f30da
@ -869,9 +869,9 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlockBlobClient::UploadFromBuffer.
|
||||
* @brief Optional parameters for BlockBlobClient::UploadFrom.
|
||||
*/
|
||||
struct ConcurrentUploadBlockBlobFromBufferOptions
|
||||
struct UploadBlockBlobFromOptions
|
||||
{
|
||||
/**
|
||||
* @brief Context for cancelling long running operations.
|
||||
@ -904,8 +904,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
int Concurrency = 1;
|
||||
};
|
||||
|
||||
using ConcurrentUploadBlockBlobFromFileOptions = ConcurrentUploadBlockBlobFromBufferOptions;
|
||||
|
||||
/**
|
||||
* @brief Optional parameters for BlockBlobClient::StageBlock.
|
||||
*/
|
||||
@ -985,7 +983,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
/**
|
||||
* @brief Optional parameters for BlockBlobClient::CommitBlockList.
|
||||
*/
|
||||
struct CommitBlobBlockListOptions
|
||||
struct CommitBlockListOptions
|
||||
{
|
||||
/**
|
||||
* @brief Context for cancelling long running operations.
|
||||
@ -1016,7 +1014,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
/**
|
||||
* @brief Optional parameters for BlockBlobClient::GetBlockList.
|
||||
*/
|
||||
struct GetBlobBlockListOptions
|
||||
struct GetBlockListOptions
|
||||
{
|
||||
/**
|
||||
* @brief Context for cancelling long running operations.
|
||||
|
||||
@ -25,8 +25,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> EncryptionKeySha256;
|
||||
};
|
||||
|
||||
using UploadBlockBlobFromBufferResult = UploadBlockBlobResult;
|
||||
using UploadBlockBlobFromFileResult = UploadBlockBlobResult;
|
||||
using UploadBlockBlobFromResult = UploadBlockBlobResult;
|
||||
|
||||
struct PageRange
|
||||
{
|
||||
|
||||
@ -135,13 +135,12 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
* @param buffer A memory buffer containing the content to upload.
|
||||
* @param bufferSize Size of the memory buffer.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A UploadBlockBlobFromBufferResult describing the state of the updated block blob.
|
||||
* @return A UploadBlockBlobFromResult describing the state of the updated block blob.
|
||||
*/
|
||||
Azure::Core::Response<UploadBlockBlobFromBufferResult> UploadFromBuffer(
|
||||
Azure::Core::Response<UploadBlockBlobFromResult> UploadFrom(
|
||||
const uint8_t* buffer,
|
||||
std::size_t bufferSize,
|
||||
const ConcurrentUploadBlockBlobFromBufferOptions& options
|
||||
= ConcurrentUploadBlockBlobFromBufferOptions()) const;
|
||||
const UploadBlockBlobFromOptions& options = UploadBlockBlobFromOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Creates a new block blob, or updates the content of an existing block blob. Updating
|
||||
@ -149,13 +148,11 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
*
|
||||
* @param file A file containing the content to upload.
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A ConcurrentUploadBlockBlobFromFileOptions describing the state of the updated block
|
||||
* blob.
|
||||
* @return A UploadBlockBlobFromResult describing the state of the updated block blob.
|
||||
*/
|
||||
Azure::Core::Response<UploadBlockBlobFromFileResult> UploadFromFile(
|
||||
Azure::Core::Response<UploadBlockBlobFromResult> UploadFrom(
|
||||
const std::string& file,
|
||||
const ConcurrentUploadBlockBlobFromFileOptions& options
|
||||
= ConcurrentUploadBlockBlobFromFileOptions()) const;
|
||||
const UploadBlockBlobFromOptions& options = UploadBlockBlobFromOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Creates a new block as part of a block blob's staging area to be eventually
|
||||
@ -203,9 +200,9 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A CommitBlobBlockListResult describing the state of the updated block blob.
|
||||
*/
|
||||
Azure::Core::Response<CommitBlobBlockListResult> CommitBlockList(
|
||||
Azure::Core::Response<CommitBlockListResult> CommitBlockList(
|
||||
const std::vector<std::pair<BlockType, std::string>>& blockIds,
|
||||
const CommitBlobBlockListOptions& options = CommitBlobBlockListOptions()) const;
|
||||
const CommitBlockListOptions& options = CommitBlockListOptions()) const;
|
||||
|
||||
/**
|
||||
* @brief Retrieves the list of blocks that have been uploaded as part of a block blob. There
|
||||
@ -217,8 +214,8 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
* @param options Optional parameters to execute this function.
|
||||
* @return A GetBlobBlockListResult describing requested block list.
|
||||
*/
|
||||
Azure::Core::Response<GetBlobBlockListResult> GetBlockList(
|
||||
const GetBlobBlockListOptions& options = GetBlobBlockListOptions()) const;
|
||||
Azure::Core::Response<GetBlockListResult> GetBlockList(
|
||||
const GetBlockListOptions& options = GetBlockListOptions()) const;
|
||||
|
||||
private:
|
||||
explicit BlockBlobClient(BlobClient blobClient);
|
||||
|
||||
@ -664,7 +664,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> EncryptionScope;
|
||||
}; // struct ClearPageBlobPagesResult
|
||||
|
||||
struct CommitBlobBlockListResult
|
||||
struct CommitBlockListResult
|
||||
{
|
||||
std::string ETag;
|
||||
std::string LastModified;
|
||||
@ -675,7 +675,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<bool> ServerEncrypted;
|
||||
Azure::Core::Nullable<std::string> EncryptionKeySha256;
|
||||
Azure::Core::Nullable<std::string> EncryptionScope;
|
||||
}; // struct CommitBlobBlockListResult
|
||||
}; // struct CommitBlockListResult
|
||||
|
||||
enum class CopyStatus
|
||||
{
|
||||
@ -1370,16 +1370,6 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Blobs::AccountKind AccountKind = Blobs::AccountKind::Unknown;
|
||||
}; // struct GetAccountInfoResult
|
||||
|
||||
struct GetBlobBlockListResult
|
||||
{
|
||||
std::string ETag;
|
||||
std::string LastModified;
|
||||
std::string ContentType;
|
||||
int64_t ContentLength = 0;
|
||||
std::vector<BlobBlock> CommittedBlocks;
|
||||
std::vector<BlobBlock> UncommittedBlocks;
|
||||
}; // struct GetBlobBlockListResult
|
||||
|
||||
struct GetBlobPropertiesResult
|
||||
{
|
||||
std::string ETag;
|
||||
@ -1408,6 +1398,16 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> CopyCompletionTime;
|
||||
}; // struct GetBlobPropertiesResult
|
||||
|
||||
struct GetBlockListResult
|
||||
{
|
||||
std::string ETag;
|
||||
std::string LastModified;
|
||||
std::string ContentType;
|
||||
int64_t ContentLength = 0;
|
||||
std::vector<BlobBlock> CommittedBlocks;
|
||||
std::vector<BlobBlock> UncommittedBlocks;
|
||||
}; // struct GetBlockListResult
|
||||
|
||||
struct GetContainerAccessPolicyResult
|
||||
{
|
||||
PublicAccessType AccessType = PublicAccessType::Private;
|
||||
@ -6312,7 +6312,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
struct CommitBlobBlockListOptions
|
||||
struct CommitBlockListOptions
|
||||
{
|
||||
Azure::Core::Nullable<int32_t> Timeout;
|
||||
std::vector<std::pair<BlockType, std::string>> BlockList;
|
||||
@ -6328,19 +6328,19 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
Azure::Core::Nullable<std::string> IfMatch;
|
||||
Azure::Core::Nullable<std::string> IfNoneMatch;
|
||||
Azure::Core::Nullable<AccessTier> Tier;
|
||||
}; // struct CommitBlobBlockListOptions
|
||||
}; // struct CommitBlockListOptions
|
||||
|
||||
static Azure::Core::Response<CommitBlobBlockListResult> CommitBlockList(
|
||||
static Azure::Core::Response<CommitBlockListResult> CommitBlockList(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const std::string& url,
|
||||
const CommitBlobBlockListOptions& options)
|
||||
const CommitBlockListOptions& options)
|
||||
{
|
||||
unused(options);
|
||||
std::string xml_body;
|
||||
{
|
||||
XmlWriter writer;
|
||||
CommitBlobBlockListOptionsToXml(writer, options);
|
||||
CommitBlockListOptionsToXml(writer, options);
|
||||
xml_body = writer.GetDocument();
|
||||
writer.Write(XmlNode{XmlNodeType::End});
|
||||
}
|
||||
@ -6438,7 +6438,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
CommitBlobBlockListResult response;
|
||||
CommitBlockListResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -6471,22 +6471,22 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
{
|
||||
response.EncryptionScope = response_encryption_scope_iterator->second;
|
||||
}
|
||||
return Azure::Core::Response<CommitBlobBlockListResult>(
|
||||
return Azure::Core::Response<CommitBlockListResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
struct GetBlobBlockListOptions
|
||||
struct GetBlockListOptions
|
||||
{
|
||||
Azure::Core::Nullable<int32_t> Timeout;
|
||||
Azure::Core::Nullable<BlockListTypeOption> ListType;
|
||||
Azure::Core::Nullable<std::string> LeaseId;
|
||||
}; // struct GetBlobBlockListOptions
|
||||
}; // struct GetBlockListOptions
|
||||
|
||||
static Azure::Core::Response<GetBlobBlockListResult> GetBlockList(
|
||||
static Azure::Core::Response<GetBlockListResult> GetBlockList(
|
||||
const Azure::Core::Context& context,
|
||||
Azure::Core::Http::HttpPipeline& pipeline,
|
||||
const std::string& url,
|
||||
const GetBlobBlockListOptions& options)
|
||||
const GetBlockListOptions& options)
|
||||
{
|
||||
unused(options);
|
||||
auto request = Azure::Core::Http::Request(Azure::Core::Http::HttpMethod::Get, url);
|
||||
@ -6508,7 +6508,7 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
}
|
||||
auto pHttpResponse = pipeline.Send(context, request);
|
||||
Azure::Core::Http::RawResponse& httpResponse = *pHttpResponse;
|
||||
GetBlobBlockListResult response;
|
||||
GetBlockListResult response;
|
||||
auto http_status_code
|
||||
= static_cast<std::underlying_type<Azure::Core::Http::HttpStatusCode>::type>(
|
||||
httpResponse.GetStatusCode());
|
||||
@ -6520,21 +6520,21 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
const auto& httpResponseBody = httpResponse.GetBody();
|
||||
XmlReader reader(
|
||||
reinterpret_cast<const char*>(httpResponseBody.data()), httpResponseBody.size());
|
||||
response = GetBlobBlockListResultFromXml(reader);
|
||||
response = GetBlockListResultFromXml(reader);
|
||||
}
|
||||
response.ETag = httpResponse.GetHeaders().at("etag");
|
||||
response.LastModified = httpResponse.GetHeaders().at("last-modified");
|
||||
response.ContentType = httpResponse.GetHeaders().at("content-type");
|
||||
response.ContentLength
|
||||
= std::stoll(httpResponse.GetHeaders().at("x-ms-blob-content-length"));
|
||||
return Azure::Core::Response<GetBlobBlockListResult>(
|
||||
return Azure::Core::Response<GetBlockListResult>(
|
||||
std::move(response), std::move(pHttpResponse));
|
||||
}
|
||||
|
||||
private:
|
||||
static GetBlobBlockListResult GetBlobBlockListResultFromXml(XmlReader& reader)
|
||||
static GetBlockListResult GetBlockListResultFromXml(XmlReader& reader)
|
||||
{
|
||||
GetBlobBlockListResult ret;
|
||||
GetBlockListResult ret;
|
||||
enum class XmlTagName
|
||||
{
|
||||
k_BlockList,
|
||||
@ -6663,9 +6663,9 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void CommitBlobBlockListOptionsToXml(
|
||||
static void CommitBlockListOptionsToXml(
|
||||
XmlWriter& writer,
|
||||
const CommitBlobBlockListOptions& options)
|
||||
const CommitBlockListOptions& options)
|
||||
{
|
||||
writer.Write(XmlNode{XmlNodeType::StartTag, "BlockList"});
|
||||
for (const auto& i : options.BlockList)
|
||||
|
||||
@ -29,8 +29,7 @@ void BlobsGettingStarted()
|
||||
|
||||
BlockBlobClient blobClient = containerClient.GetBlockBlobClient(blobName);
|
||||
|
||||
blobClient.UploadFromBuffer(
|
||||
reinterpret_cast<const uint8_t*>(blobContent.data()), blobContent.size());
|
||||
blobClient.UploadFrom(reinterpret_cast<const uint8_t*>(blobContent.data()), blobContent.size());
|
||||
|
||||
std::map<std::string, std::string> blobMetadata = {{"key1", "value1"}, {"key2", "value2"}};
|
||||
blobClient.SetMetadata(blobMetadata);
|
||||
|
||||
@ -101,10 +101,10 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
options.Context, *m_pipeline, m_blobUrl.ToString(), content, protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<UploadBlockBlobFromBufferResult> BlockBlobClient::UploadFromBuffer(
|
||||
Azure::Core::Response<UploadBlockBlobFromResult> BlockBlobClient::UploadFrom(
|
||||
const uint8_t* buffer,
|
||||
std::size_t bufferSize,
|
||||
const ConcurrentUploadBlockBlobFromBufferOptions& options) const
|
||||
const UploadBlockBlobFromOptions& options) const
|
||||
{
|
||||
constexpr int64_t c_defaultBlockSize = 8 * 1024 * 1024;
|
||||
constexpr int64_t c_maximumNumberBlocks = 50000;
|
||||
@ -159,29 +159,29 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
blockIds[i].first = BlockType::Uncommitted;
|
||||
blockIds[i].second = getBlockId(static_cast<int64_t>(i));
|
||||
}
|
||||
CommitBlobBlockListOptions commitBlockListOptions;
|
||||
CommitBlockListOptions commitBlockListOptions;
|
||||
commitBlockListOptions.Context = options.Context;
|
||||
commitBlockListOptions.HttpHeaders = options.HttpHeaders;
|
||||
commitBlockListOptions.Metadata = options.Metadata;
|
||||
commitBlockListOptions.Tier = options.Tier;
|
||||
auto commitBlockListResponse = CommitBlockList(blockIds, commitBlockListOptions);
|
||||
|
||||
UploadBlockBlobFromBufferResult ret;
|
||||
UploadBlockBlobFromResult ret;
|
||||
ret.ETag = std::move(commitBlockListResponse->ETag);
|
||||
ret.LastModified = std::move(commitBlockListResponse->LastModified);
|
||||
ret.VersionId = std::move(commitBlockListResponse->VersionId);
|
||||
ret.ServerEncrypted = commitBlockListResponse->ServerEncrypted;
|
||||
ret.EncryptionKeySha256 = std::move(commitBlockListResponse->EncryptionKeySha256);
|
||||
ret.EncryptionScope = std::move(commitBlockListResponse->EncryptionScope);
|
||||
return Azure::Core::Response<UploadBlockBlobFromBufferResult>(
|
||||
return Azure::Core::Response<UploadBlockBlobFromResult>(
|
||||
std::move(ret),
|
||||
std::make_unique<Azure::Core::Http::RawResponse>(
|
||||
std::move(commitBlockListResponse.GetRawResponse())));
|
||||
}
|
||||
|
||||
Azure::Core::Response<UploadBlockBlobFromFileResult> BlockBlobClient::UploadFromFile(
|
||||
Azure::Core::Response<UploadBlockBlobFromResult> BlockBlobClient::UploadFrom(
|
||||
const std::string& file,
|
||||
const ConcurrentUploadBlockBlobFromFileOptions& options) const
|
||||
const UploadBlockBlobFromOptions& options) const
|
||||
{
|
||||
constexpr int64_t c_defaultBlockSize = 8 * 1024 * 1024;
|
||||
constexpr int64_t c_maximumNumberBlocks = 50000;
|
||||
@ -241,21 +241,21 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
blockIds[i].first = BlockType::Uncommitted;
|
||||
blockIds[i].second = getBlockId(static_cast<int64_t>(i));
|
||||
}
|
||||
CommitBlobBlockListOptions commitBlockListOptions;
|
||||
CommitBlockListOptions commitBlockListOptions;
|
||||
commitBlockListOptions.Context = options.Context;
|
||||
commitBlockListOptions.HttpHeaders = options.HttpHeaders;
|
||||
commitBlockListOptions.Metadata = options.Metadata;
|
||||
commitBlockListOptions.Tier = options.Tier;
|
||||
auto commitBlockListResponse = CommitBlockList(blockIds, commitBlockListOptions);
|
||||
|
||||
UploadBlockBlobFromBufferResult result;
|
||||
UploadBlockBlobFromResult result;
|
||||
result.ETag = commitBlockListResponse->ETag;
|
||||
result.LastModified = commitBlockListResponse->LastModified;
|
||||
result.VersionId = commitBlockListResponse->VersionId;
|
||||
result.ServerEncrypted = commitBlockListResponse->ServerEncrypted;
|
||||
result.EncryptionKeySha256 = commitBlockListResponse->EncryptionKeySha256;
|
||||
result.EncryptionScope = commitBlockListResponse->EncryptionScope;
|
||||
return Azure::Core::Response<UploadBlockBlobFromBufferResult>(
|
||||
return Azure::Core::Response<UploadBlockBlobFromResult>(
|
||||
std::move(result),
|
||||
std::make_unique<Azure::Core::Http::RawResponse>(
|
||||
std::move(commitBlockListResponse.GetRawResponse())));
|
||||
@ -321,11 +321,11 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
options.Context, *m_pipeline, m_blobUrl.ToString(), protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<CommitBlobBlockListResult> BlockBlobClient::CommitBlockList(
|
||||
Azure::Core::Response<CommitBlockListResult> BlockBlobClient::CommitBlockList(
|
||||
const std::vector<std::pair<BlockType, std::string>>& blockIds,
|
||||
const CommitBlobBlockListOptions& options) const
|
||||
const CommitBlockListOptions& options) const
|
||||
{
|
||||
BlobRestClient::BlockBlob::CommitBlobBlockListOptions protocolLayerOptions;
|
||||
BlobRestClient::BlockBlob::CommitBlockListOptions protocolLayerOptions;
|
||||
protocolLayerOptions.BlockList = blockIds;
|
||||
protocolLayerOptions.HttpHeaders = options.HttpHeaders;
|
||||
protocolLayerOptions.Metadata = options.Metadata;
|
||||
@ -346,10 +346,10 @@ namespace Azure { namespace Storage { namespace Blobs {
|
||||
options.Context, *m_pipeline, m_blobUrl.ToString(), protocolLayerOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<GetBlobBlockListResult> BlockBlobClient::GetBlockList(
|
||||
const GetBlobBlockListOptions& options) const
|
||||
Azure::Core::Response<GetBlockListResult> BlockBlobClient::GetBlockList(
|
||||
const GetBlockListOptions& options) const
|
||||
{
|
||||
BlobRestClient::BlockBlob::GetBlobBlockListOptions protocolLayerOptions;
|
||||
BlobRestClient::BlockBlob::GetBlockListOptions protocolLayerOptions;
|
||||
protocolLayerOptions.ListType = options.ListType;
|
||||
protocolLayerOptions.LeaseId = options.AccessConditions.LeaseId;
|
||||
return BlobRestClient::BlockBlob::GetBlockList(
|
||||
|
||||
@ -327,13 +327,13 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
const std::string& file,
|
||||
const UploadFileOptions& options) const
|
||||
{
|
||||
Blobs::ConcurrentUploadBlockBlobFromBufferOptions blobOptions;
|
||||
Blobs::UploadBlockBlobFromOptions blobOptions;
|
||||
blobOptions.Context = options.Context;
|
||||
blobOptions.ChunkSize = options.ChunkSize;
|
||||
blobOptions.HttpHeaders = FromDataLakeHttpHeaders(options.HttpHeaders);
|
||||
blobOptions.Metadata = options.Metadata;
|
||||
blobOptions.Concurrency = options.Concurrency;
|
||||
return m_blockBlobClient.UploadFromFile(file, blobOptions);
|
||||
return m_blockBlobClient.UploadFrom(file, blobOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<FileContentInfo> FileClient::UploadFromBuffer(
|
||||
@ -341,13 +341,13 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake {
|
||||
std::size_t bufferSize,
|
||||
const UploadFileOptions& options) const
|
||||
{
|
||||
Blobs::ConcurrentUploadBlockBlobFromBufferOptions blobOptions;
|
||||
Blobs::UploadBlockBlobFromOptions blobOptions;
|
||||
blobOptions.Context = options.Context;
|
||||
blobOptions.ChunkSize = options.ChunkSize;
|
||||
blobOptions.HttpHeaders = FromDataLakeHttpHeaders(options.HttpHeaders);
|
||||
blobOptions.Metadata = options.Metadata;
|
||||
blobOptions.Concurrency = options.Concurrency;
|
||||
return m_blockBlobClient.UploadFromBuffer(buffer, bufferSize, blobOptions);
|
||||
return m_blockBlobClient.UploadFrom(buffer, bufferSize, blobOptions);
|
||||
}
|
||||
|
||||
Azure::Core::Response<FileDownloadInfo> FileClient::DownloadToBuffer(
|
||||
|
||||
@ -465,7 +465,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
std::vector<uint8_t> blobContent(512);
|
||||
Azure::Core::Http::MemoryBodyStream bodyStream(blobContent.data(), blobContent.size());
|
||||
auto copySourceBlob = m_blobContainerClient->GetBlockBlobClient(RandomString());
|
||||
copySourceBlob.UploadFromBuffer(blobContent.data(), blobContent.size());
|
||||
copySourceBlob.UploadFrom(blobContent.data(), blobContent.size());
|
||||
|
||||
{
|
||||
std::string blockBlobName = RandomString();
|
||||
|
||||
@ -243,7 +243,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
auto blockContent
|
||||
= Azure::Core::Http::MemoryBodyStream(block1Content.data(), block1Content.size());
|
||||
blockBlobClient.StageBlock(blockId1, &blockContent);
|
||||
Azure::Storage::Blobs::CommitBlobBlockListOptions options;
|
||||
Azure::Storage::Blobs::CommitBlockListOptions options;
|
||||
options.HttpHeaders = m_blobUploadOptions.HttpHeaders;
|
||||
options.Metadata = m_blobUploadOptions.Metadata;
|
||||
auto blobContentInfo = blockBlobClient.CommitBlockList(
|
||||
@ -265,7 +265,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
EXPECT_TRUE(res->UncommittedBlocks.empty());
|
||||
|
||||
blockBlobClient.StageBlockFromUri(blockId2, m_blockBlobClient->GetUri() + GetSas());
|
||||
Blobs::GetBlobBlockListOptions options2;
|
||||
Blobs::GetBlockListOptions options2;
|
||||
options2.ListType = Blobs::BlockListTypeOption::All;
|
||||
res = blockBlobClient.GetBlockList(options2);
|
||||
EXPECT_EQ(res->ContentLength, static_cast<int64_t>(block1Content.size()));
|
||||
@ -430,7 +430,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
auto blockBlobClient = Azure::Storage::Blobs::BlockBlobClient::CreateFromConnectionString(
|
||||
StandardStorageConnectionString(), m_containerName, RandomString());
|
||||
std::string emptyFilename = RandomString();
|
||||
EXPECT_THROW(blockBlobClient.UploadFromFile(emptyFilename), std::runtime_error);
|
||||
EXPECT_THROW(blockBlobClient.UploadFrom(emptyFilename), std::runtime_error);
|
||||
EXPECT_THROW(blockBlobClient.Delete(), StorageError);
|
||||
}
|
||||
|
||||
@ -452,14 +452,14 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
auto blockBlobClient = Azure::Storage::Blobs::BlockBlobClient::CreateFromConnectionString(
|
||||
StandardStorageConnectionString(), m_containerName, RandomString());
|
||||
|
||||
blockBlobClient.UploadFromBuffer(emptyContent.data(), emptyContent.size());
|
||||
blockBlobClient.UploadFrom(emptyContent.data(), emptyContent.size());
|
||||
EXPECT_NO_THROW(blockBlobClient.Delete());
|
||||
|
||||
std::string emptyFilename = RandomString();
|
||||
{
|
||||
Details::FileWriter writer(emptyFilename);
|
||||
}
|
||||
blockBlobClient.UploadFromFile(emptyFilename);
|
||||
blockBlobClient.UploadFrom(emptyFilename);
|
||||
EXPECT_NO_THROW(blockBlobClient.Delete());
|
||||
|
||||
DeleteFile(emptyFilename);
|
||||
@ -577,7 +577,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
for (int64_t length :
|
||||
{0ULL, 1ULL, 2ULL, 2_KB, 4_KB, 999_KB, 1_MB, 2_MB - 1, 3_MB, 5_MB, 8_MB - 1234, 8_MB})
|
||||
{
|
||||
Azure::Storage::Blobs::ConcurrentUploadBlockBlobFromBufferOptions options;
|
||||
Azure::Storage::Blobs::UploadBlockBlobFromOptions options;
|
||||
options.ChunkSize = 1_MB;
|
||||
options.Concurrency = c;
|
||||
options.HttpHeaders = m_blobUploadOptions.HttpHeaders;
|
||||
@ -585,7 +585,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
options.Metadata = m_blobUploadOptions.Metadata;
|
||||
options.Tier = m_blobUploadOptions.Tier;
|
||||
{
|
||||
auto res = blockBlobClient.UploadFromBuffer(
|
||||
auto res = blockBlobClient.UploadFrom(
|
||||
m_blobContent.data(), static_cast<std::size_t>(length), options);
|
||||
EXPECT_FALSE(res->ETag.empty());
|
||||
EXPECT_FALSE(res->LastModified.empty());
|
||||
@ -610,7 +610,7 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
Azure::Storage::Details::FileWriter fileWriter(tempFilename);
|
||||
fileWriter.Write(m_blobContent.data(), length, 0);
|
||||
}
|
||||
auto res = blockBlobClient.UploadFromFile(tempFilename, options);
|
||||
auto res = blockBlobClient.UploadFrom(tempFilename, options);
|
||||
EXPECT_FALSE(res->ETag.empty());
|
||||
EXPECT_FALSE(res->LastModified.empty());
|
||||
EXPECT_FALSE(res->SequenceNumber.HasValue());
|
||||
|
||||
@ -38,12 +38,12 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
fileSize = static_cast<std::size_t>(reader.GetFileSize());
|
||||
}
|
||||
|
||||
Blobs::ConcurrentUploadBlockBlobFromFileOptions options;
|
||||
Blobs::UploadBlockBlobFromOptions options;
|
||||
options.Concurrency = concurrency;
|
||||
auto timer_start = std::chrono::steady_clock::now();
|
||||
try
|
||||
{
|
||||
auto res = blockBlobClient.UploadFromFile(sourceFile, options);
|
||||
auto res = blockBlobClient.UploadFrom(sourceFile, options);
|
||||
}
|
||||
catch (std::exception& e)
|
||||
{
|
||||
|
||||
@ -17,10 +17,10 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
constexpr std::size_t bufferSize = static_cast<std::size_t>(1_GB);
|
||||
std::vector<uint8_t> buffer = RandomBuffer(bufferSize);
|
||||
{
|
||||
Blobs::ConcurrentUploadBlockBlobFromBufferOptions options;
|
||||
Blobs::UploadBlockBlobFromOptions options;
|
||||
options.ChunkSize = 8_MB;
|
||||
auto timer_start = std::chrono::steady_clock::now();
|
||||
auto res = blockBlobClient.UploadFromBuffer(buffer.data(), buffer.size(), options);
|
||||
auto res = blockBlobClient.UploadFrom(buffer.data(), buffer.size(), options);
|
||||
auto timer_end = std::chrono::steady_clock::now();
|
||||
|
||||
double speed = static_cast<double>(bufferSize) / 1_MB
|
||||
@ -61,15 +61,14 @@ namespace Azure { namespace Storage { namespace Test {
|
||||
|
||||
{
|
||||
std::vector<std::future<void>> futures;
|
||||
Blobs::ConcurrentUploadBlockBlobFromBufferOptions options;
|
||||
Blobs::UploadBlockBlobFromOptions options;
|
||||
options.ChunkSize = 8_MB;
|
||||
auto timer_start = std::chrono::steady_clock::now();
|
||||
for (int i = 0; i < concurrency; ++i)
|
||||
{
|
||||
futures.emplace_back(
|
||||
std::async(std::launch::async, [&blockBlobClients, &buffer, &options, i]() {
|
||||
auto res
|
||||
= blockBlobClients[i].UploadFromBuffer(buffer.data(), buffer.size(), options);
|
||||
auto res = blockBlobClients[i].UploadFrom(buffer.data(), buffer.size(), options);
|
||||
}));
|
||||
}
|
||||
for (auto& f : futures)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user