diff --git a/sdk/core/azure-core/CHANGELOG.md b/sdk/core/azure-core/CHANGELOG.md index 1442ecd96..475a5bd48 100644 --- a/sdk/core/azure-core/CHANGELOG.md +++ b/sdk/core/azure-core/CHANGELOG.md @@ -36,6 +36,7 @@ - Introduced `Azure::Core::Http::LogOptions`, a mandatory parameter for `LogPolicy` construction. Entities that are not specified in the allow lists are hidden in the log. - Moved `Azure::Core::Logging` namespace entities to `Azure::Core::Logger` class. - Removed `Azure::Core::DateTime::GetRfc3339String()`: `Azure::Core::DateTime::ToString()` was extended to provide the same functionality. +- Renamed the `Range` type to `HttpRange` within the `Azure::Core::Http` namespace. - Moved `Azure::Core::Response` to `Azure::Response`. - Moved types in the `Azure::IO` namespace like `BodyStream` to `Azure::Core::IO`. - Moved `Azure::Core::ETag` to `Azure::ETag`. diff --git a/sdk/core/azure-core/inc/azure/core/http/http.hpp b/sdk/core/azure-core/inc/azure/core/http/http.hpp index 771169dd3..568655483 100644 --- a/sdk/core/azure-core/inc/azure/core/http/http.hpp +++ b/sdk/core/azure-core/inc/azure/core/http/http.hpp @@ -196,7 +196,7 @@ namespace Azure { namespace Core { namespace Http { * `Offset + Length - 1` inclusively. * */ - struct Range + struct HttpRange { /** * @brief The starting point of the HTTP Range. diff --git a/sdk/core/azure-core/test/ut/http.cpp b/sdk/core/azure-core/test/ut/http.cpp index 19c8a5dea..0791e03af 100644 --- a/sdk/core/azure-core/test/ut/http.cpp +++ b/sdk/core/azure-core/test/ut/http.cpp @@ -126,29 +126,29 @@ namespace Azure { namespace Core { namespace Test { } // HTTP Range - TEST(TestHttp, Range) + TEST(TestHttp, HttpRange) { { - Http::Range r{10, 1}; + Http::HttpRange r{10, 1}; EXPECT_EQ(r.Offset, 10); EXPECT_TRUE(r.Length.HasValue()); EXPECT_EQ(r.Length.GetValue(), 1); } { - Http::Range r; + Http::HttpRange r; r.Offset = 10; EXPECT_EQ(r.Offset, 10); EXPECT_FALSE(r.Length.HasValue()); } { - Http::Range r; + Http::HttpRange r; r.Length = 10; EXPECT_EQ(r.Offset, 0); EXPECT_TRUE(r.Length.HasValue()); EXPECT_EQ(r.Length.GetValue(), 10); } { - Http::Range r; + Http::HttpRange r; EXPECT_EQ(r.Offset, 0); EXPECT_FALSE(r.Length.HasValue()); } diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp index c16dcf061..76aea1028 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_options.hpp @@ -497,7 +497,7 @@ namespace Azure { namespace Storage { namespace Blobs { /** * @brief Downloads only the bytes of the blob in the specified range. */ - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; /** * @brief When specified together with Range, service returns hash for the range as long as the @@ -519,7 +519,7 @@ namespace Azure { namespace Storage { namespace Blobs { /** * @brief Downloads only the bytes of the blob in the specified range. */ - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; struct { @@ -772,7 +772,7 @@ namespace Azure { namespace Storage { namespace Blobs { /** * @brief Uploads only the bytes of the source blob in the specified range. */ - Azure::Core::Nullable SourceRange; + Azure::Core::Nullable SourceRange; /** * @brief Hash of the blob content. This hash is used to verify the integrity of @@ -886,7 +886,7 @@ namespace Azure { namespace Storage { namespace Blobs { /** * @brief Uploads only the bytes of the source blob in the specified range. */ - Azure::Core::Nullable SourceRange; + Azure::Core::Nullable SourceRange; /** * @brief Hash of the blob content. This hash is used to verify the integrity of @@ -1011,7 +1011,7 @@ namespace Azure { namespace Storage { namespace Blobs { * @brief Optionally specifies the range of bytes over which to list ranges, inclusively. If * omitted, then all ranges for the blob are returned. */ - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; /** * @brief Optional conditions that must be met to perform this operation. diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_responses.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_responses.hpp index 5418fe4b6..cda6f3e3c 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_responses.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/blob_responses.hpp @@ -22,7 +22,7 @@ namespace Azure { namespace Storage { namespace Blobs { struct DownloadBlobToResult { Models::BlobType BlobType; - Azure::Core::Http::Range ContentRange; + Azure::Core::Http::HttpRange ContentRange; int64_t BlobSize = 0; Azure::Core::Nullable TransactionalContentHash; // hash for the downloaded range DownloadBlobDetails Details; diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/page_blob_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/page_blob_client.hpp index bf6fa113a..a2c7db4de 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/page_blob_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/page_blob_client.hpp @@ -172,7 +172,7 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::Response UploadPagesFromUri( int64_t destinationOffset, std::string sourceUri, - Azure::Core::Http::Range sourceRange, + Azure::Core::Http::HttpRange sourceRange, const UploadPageBlobPagesFromUriOptions& options = UploadPageBlobPagesFromUriOptions(), const Azure::Core::Context& context = Azure::Core::Context()) const; @@ -189,7 +189,7 @@ namespace Azure { namespace Storage { namespace Blobs { * @return A ClearPageBlobPagesResult describing the state of the updated pages. */ Azure::Response ClearPages( - Azure::Core::Http::Range range, + Azure::Core::Http::HttpRange range, const ClearPageBlobPagesOptions& options = ClearPageBlobPagesOptions(), const Azure::Core::Context& context = Azure::Core::Context()) const; diff --git a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp index 7d51d10a8..6b304f87c 100644 --- a/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp +++ b/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp @@ -432,8 +432,8 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::ETag ETag; Azure::DateTime LastModified; int64_t BlobSize = 0; - std::vector PageRanges; - std::vector ClearRanges; + std::vector PageRanges; + std::vector ClearRanges; }; // struct GetPageBlobPageRangesResult enum class ListBlobContainersIncludeFlags @@ -1128,7 +1128,7 @@ namespace Azure { namespace Storage { namespace Blobs { { std::string RequestId; std::unique_ptr BodyStream; - Azure::Core::Http::Range ContentRange; + Azure::Core::Http::HttpRange ContentRange; int64_t BlobSize = 0; Models::BlobType BlobType; Azure::Core::Nullable TransactionalContentHash; // hash for the downloaded range @@ -4822,7 +4822,7 @@ namespace Azure { namespace Storage { namespace Blobs { struct DownloadBlobOptions { Azure::Core::Nullable Timeout; - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; Azure::Core::Nullable RangeHashAlgorithm; Azure::Core::Nullable EncryptionKey; Azure::Core::Nullable> EncryptionKeySha256; @@ -4958,12 +4958,12 @@ namespace Azure { namespace Storage { namespace Blobs { content_range.begin() + bytes_pos + 6, content_range.begin() + dash_pos)); int64_t range_end_offset = std::stoll(std::string( content_range.begin() + dash_pos + 1, content_range.begin() + slash_pos)); - response.ContentRange = Azure::Core::Http::Range{ + response.ContentRange = Azure::Core::Http::HttpRange{ range_start_offset, range_end_offset - range_start_offset + 1}; } else { - response.ContentRange = Azure::Core::Http::Range{ + response.ContentRange = Azure::Core::Http::HttpRange{ 0, std::stoll(httpResponse.GetHeaders().at("content-length"))}; } if (content_range_iterator != httpResponse.GetHeaders().end()) @@ -7188,7 +7188,7 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::Core::Nullable Timeout; std::string BlockId; std::string SourceUri; - Azure::Core::Nullable SourceRange; + Azure::Core::Nullable SourceRange; Azure::Core::Nullable TransactionalContentHash; Azure::Core::Nullable LeaseId; Azure::Core::Nullable EncryptionKey; @@ -7884,7 +7884,7 @@ namespace Azure { namespace Storage { namespace Blobs { struct UploadPageBlobPagesOptions { Azure::Core::Nullable Timeout; - Azure::Core::Http::Range Range; + Azure::Core::Http::HttpRange Range; Azure::Core::Nullable TransactionalContentHash; Azure::Core::Nullable LeaseId; Azure::Core::Nullable IfSequenceNumberLessThanOrEqualTo; @@ -8068,8 +8068,8 @@ namespace Azure { namespace Storage { namespace Blobs { { Azure::Core::Nullable Timeout; std::string SourceUri; - Azure::Core::Http::Range SourceRange; - Azure::Core::Http::Range Range; + Azure::Core::Http::HttpRange SourceRange; + Azure::Core::Http::HttpRange Range; Azure::Core::Nullable TransactionalContentHash; Azure::Core::Nullable LeaseId; Azure::Core::Nullable IfSequenceNumberLessThanOrEqualTo; @@ -8260,7 +8260,7 @@ namespace Azure { namespace Storage { namespace Blobs { struct ClearPageBlobPagesOptions { Azure::Core::Nullable Timeout; - Azure::Core::Http::Range Range; + Azure::Core::Http::HttpRange Range; Azure::Core::Nullable LeaseId; Azure::Core::Nullable IfSequenceNumberLessThanOrEqualTo; Azure::Core::Nullable IfSequenceNumberLessThan; @@ -8515,7 +8515,7 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::Core::Nullable Timeout; Azure::Core::Nullable PreviousSnapshot; Azure::Core::Nullable PreviousSnapshotUrl; - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; Azure::Core::Nullable LeaseId; Azure::Core::Nullable IfModifiedSince; Azure::Core::Nullable IfUnmodifiedSince; @@ -8763,7 +8763,7 @@ namespace Azure { namespace Storage { namespace Blobs { return ret; } - static Azure::Core::Http::Range ClearRangesFromXml(Storage::_detail::XmlReader& reader) + static Azure::Core::Http::HttpRange ClearRangesFromXml(Storage::_detail::XmlReader& reader) { int depth = 0; bool is_start = false; @@ -8812,13 +8812,13 @@ namespace Azure { namespace Storage { namespace Blobs { } } } - Azure::Core::Http::Range ret; + Azure::Core::Http::HttpRange ret; ret.Offset = start; ret.Length = end - start + 1; return ret; } - static Azure::Core::Http::Range PageRangesFromXml(Storage::_detail::XmlReader& reader) + static Azure::Core::Http::HttpRange PageRangesFromXml(Storage::_detail::XmlReader& reader) { int depth = 0; bool is_start = false; @@ -8867,7 +8867,7 @@ namespace Azure { namespace Storage { namespace Blobs { } } } - Azure::Core::Http::Range ret; + Azure::Core::Http::HttpRange ret; ret.Offset = start; ret.Length = end - start + 1; return ret; @@ -9195,7 +9195,7 @@ namespace Azure { namespace Storage { namespace Blobs { { Azure::Core::Nullable Timeout; std::string SourceUri; - Azure::Core::Nullable SourceRange; + Azure::Core::Nullable SourceRange; Azure::Core::Nullable TransactionalContentHash; Azure::Core::Nullable LeaseId; Azure::Core::Nullable MaxSize; diff --git a/sdk/storage/azure-storage-blobs/src/blob_client.cpp b/sdk/storage/azure-storage-blobs/src/blob_client.cpp index fe2b2d2cd..5eae834b0 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_client.cpp @@ -197,7 +197,7 @@ namespace Azure { namespace Storage { namespace Blobs { const HttpGetterInfo& retryInfo, const Azure::Core::Context& context) -> std::unique_ptr { DownloadBlobOptions newOptions = options; - newOptions.Range = Core::Http::Range(); + newOptions.Range = Core::Http::HttpRange(); newOptions.Range.GetValue().Offset = (options.Range.HasValue() ? options.Range.GetValue().Offset : 0) + retryInfo.Offset; if (options.Range.HasValue() && options.Range.GetValue().Length.HasValue()) @@ -302,7 +302,7 @@ namespace Azure { namespace Storage { namespace Blobs { auto downloadChunkFunc = [&](int64_t offset, int64_t length, int64_t chunkId, int64_t numChunks) { DownloadBlobOptions chunkOptions; - chunkOptions.Range = Core::Http::Range(); + chunkOptions.Range = Core::Http::HttpRange(); chunkOptions.Range.GetValue().Offset = offset; chunkOptions.Range.GetValue().Length = length; if (!chunkOptions.AccessConditions.IfMatch.HasValue()) @@ -425,7 +425,7 @@ namespace Azure { namespace Storage { namespace Blobs { auto downloadChunkFunc = [&](int64_t offset, int64_t length, int64_t chunkId, int64_t numChunks) { DownloadBlobOptions chunkOptions; - chunkOptions.Range = Core::Http::Range(); + chunkOptions.Range = Core::Http::HttpRange(); chunkOptions.Range.GetValue().Offset = offset; chunkOptions.Range.GetValue().Length = length; if (!chunkOptions.AccessConditions.IfMatch.HasValue()) diff --git a/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp b/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp index 1e8c446d5..537ab36a2 100644 --- a/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp +++ b/sdk/storage/azure-storage-blobs/src/page_blob_client.cpp @@ -160,7 +160,7 @@ namespace Azure { namespace Storage { namespace Blobs { Azure::Response PageBlobClient::UploadPagesFromUri( int64_t destinationOffset, std::string sourceUri, - Azure::Core::Http::Range sourceRange, + Azure::Core::Http::HttpRange sourceRange, const UploadPageBlobPagesFromUriOptions& options, const Azure::Core::Context& context) const { @@ -188,7 +188,7 @@ namespace Azure { namespace Storage { namespace Blobs { } Azure::Response PageBlobClient::ClearPages( - Azure::Core::Http::Range range, + Azure::Core::Http::HttpRange range, const ClearPageBlobPagesOptions& options, const Azure::Core::Context& context) const { diff --git a/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp index 934557056..d6db195dd 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/block_blob_client_test.cpp @@ -114,7 +114,7 @@ namespace Azure { namespace Storage { namespace Test { { const int64_t downloadLength = 1024; Blobs::DownloadBlobOptions options; - options.Range = Azure::Core::Http::Range(); + options.Range = Azure::Core::Http::HttpRange(); options.Range.GetValue().Offset = 0; options.Range.GetValue().Length = downloadLength; options.RangeHashAlgorithm = HashAlgorithm::Md5; @@ -196,7 +196,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_EQ(res->BlobType, Azure::Storage::Blobs::Models::BlobType::BlockBlob); Azure::Storage::Blobs::DownloadBlobOptions options; - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = 0; EXPECT_THROW(blockBlobClient.Download(options), StorageException); options.Range.GetValue().Length = 1; @@ -481,7 +481,7 @@ namespace Azure { namespace Storage { namespace Test { options.TransferOptions.Concurrency = concurrency; if (offset.HasValue() || length.HasValue()) { - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = offset.GetValue(); options.Range.GetValue().Length = length; } @@ -553,7 +553,7 @@ namespace Azure { namespace Storage { namespace Test { options.TransferOptions.Concurrency = concurrency; if (offset.HasValue() || length.HasValue()) { - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = offset.GetValue(); options.Range.GetValue().Length = length; } @@ -638,7 +638,7 @@ namespace Azure { namespace Storage { namespace Test { // buffer not big enough Blobs::DownloadBlobToOptions options; options.TransferOptions.Concurrency = c; - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = 1; for (int64_t length : {1ULL, 2ULL, 4_KB, 5_KB, 8_KB, 11_KB, 20_KB}) { @@ -789,7 +789,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_TRUE(ReadFile(tempFilename).empty()); DeleteFile(tempFilename); - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = 0; EXPECT_THROW( blockBlobClient.DownloadTo(emptyContent.data(), static_cast(8_MB), options), diff --git a/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp index 49d953bd4..69329ea99 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/page_blob_client_test.cpp @@ -108,7 +108,7 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_EQ(static_cast(pageRanges.PageRanges[0].Length.GetValue()), 3_KB); Azure::Storage::Blobs::GetPageBlobPageRangesOptions options; - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = 4_KB; options.Range.GetValue().Length = 1_KB; pageRanges = *pageBlobClient.GetPageRanges(options); diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp index ac28298d5..cc766416e 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_options.hpp @@ -470,7 +470,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { /** * @brief Specify the range of the resource to be retrieved. */ - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; /** * @brief The hash algorithm used to calculate the hash for the returned content. diff --git a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_responses.hpp b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_responses.hpp index c023da424..c9f877788 100644 --- a/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_responses.hpp +++ b/sdk/storage/azure-storage-files-datalake/inc/azure/storage/files/datalake/datalake_responses.hpp @@ -251,7 +251,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { nam { std::unique_ptr Body; int64_t FileSize = int64_t(); - Azure::Core::Http::Range ContentRange; + Azure::Core::Http::HttpRange ContentRange; Azure::Core::Nullable TransactionalContentHash; DownloadDataLakeFileDetails Details; std::string RequestId; @@ -266,7 +266,7 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { nam struct DownloadDataLakeFileToResult { int64_t FileSize = int64_t(); - Azure::Core::Http::Range ContentRange; + Azure::Core::Http::HttpRange ContentRange; DownloadDataLakeFileDetails Details; }; diff --git a/sdk/storage/azure-storage-files-datalake/test/datalake_file_client_test.cpp b/sdk/storage/azure-storage-files-datalake/test/datalake_file_client_test.cpp index df97f62f9..57a2cc7d8 100644 --- a/sdk/storage/azure-storage-files-datalake/test/datalake_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-datalake/test/datalake_file_client_test.cpp @@ -363,7 +363,7 @@ namespace Azure { namespace Storage { namespace Test { { auto firstHalf = std::vector(buffer.begin(), buffer.begin() + (bufferSize / 2)); Files::DataLake::DownloadDataLakeFileOptions options; - options.Range = Azure::Core::Http::Range(); + options.Range = Azure::Core::Http::HttpRange(); options.Range.GetValue().Offset = 0; options.Range.GetValue().Length = bufferSize / 2; result = newFileClient->Download(options); @@ -377,7 +377,7 @@ namespace Azure { namespace Storage { namespace Test { { auto secondHalf = std::vector(buffer.begin() + bufferSize / 2, buffer.end()); Files::DataLake::DownloadDataLakeFileOptions options; - options.Range = Azure::Core::Http::Range(); + options.Range = Azure::Core::Http::HttpRange(); options.Range.GetValue().Offset = bufferSize / 2; options.Range.GetValue().Length = bufferSize / 2; result = newFileClient->Download(options); diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/protocol/share_rest_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/protocol/share_rest_client.hpp index 165d30471..e2ee79f36 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/protocol/share_rest_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/protocol/share_rest_client.hpp @@ -361,8 +361,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { // The list of file ranges struct ShareFileRangeList { - std::vector Ranges; - std::vector ClearRanges; + std::vector Ranges; + std::vector ClearRanges; }; // Stats for the share. @@ -897,7 +897,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { DateTime LastModified; Storage::Metadata Metadata; FileHttpHeaders HttpHeaders; - Azure::Core::Http::Range ContentRange; + Azure::Core::Http::HttpRange ContentRange; int64_t FileSize; Azure::ETag ETag; Azure::Core::Nullable TransactionalContentHash; @@ -1009,8 +1009,8 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { struct FileGetRangeListResult { - std::vector Ranges; - std::vector ClearRanges; + std::vector Ranges; + std::vector ClearRanges; DateTime LastModified; Azure::ETag ETag; int64_t FileSize = int64_t(); @@ -1049,7 +1049,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { class ShareRestClient { private: - static Azure::Core::Http::Range HttpRangeFromXml(Storage::_detail::XmlReader& reader) + static Azure::Core::Http::HttpRange HttpRangeFromXml(Storage::_detail::XmlReader& reader) { int depth = 0; bool is_start = false; @@ -1097,7 +1097,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { } } } - Azure::Core::Http::Range ret; + Azure::Core::Http::HttpRange ret; ret.Offset = start; ret.Length = end - start + 1; return ret; @@ -6140,12 +6140,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { content_range.begin() + bytes_pos + 6, content_range.begin() + dash_pos)); int64_t range_end_offset = std::stoll(std::string( content_range.begin() + dash_pos + 1, content_range.begin() + slash_pos)); - result.ContentRange = Azure::Core::Http::Range{ + result.ContentRange = Azure::Core::Http::HttpRange{ range_start_offset, range_end_offset - range_start_offset + 1}; } else { - result.ContentRange = Azure::Core::Http::Range{ + result.ContentRange = Azure::Core::Http::HttpRange{ 0, std::stoll(response.GetHeaders().at(_detail::HeaderContentLength))}; } if (content_range_iterator != response.GetHeaders().end()) @@ -6300,12 +6300,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { content_range.begin() + bytes_pos + 6, content_range.begin() + dash_pos)); int64_t range_end_offset = std::stoll(std::string( content_range.begin() + dash_pos + 1, content_range.begin() + slash_pos)); - result.ContentRange = Azure::Core::Http::Range{ + result.ContentRange = Azure::Core::Http::HttpRange{ range_start_offset, range_end_offset - range_start_offset + 1}; } else { - result.ContentRange = Azure::Core::Http::Range{ + result.ContentRange = Azure::Core::Http::HttpRange{ 0, std::stoll(response.GetHeaders().at(_detail::HeaderContentLength))}; } if (content_range_iterator != response.GetHeaders().end()) diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp index f4c39ab92..c853030d7 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_file_client.hpp @@ -348,7 +348,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Azure::Response UploadRangeFromUri( int64_t destinationOffset, const std::string& sourceUri, - const Azure::Core::Http::Range& sourceRange, + const Azure::Core::Http::HttpRange& sourceRange, const UploadFileRangeFromUriOptions& options = UploadFileRangeFromUriOptions(), const Azure::Core::Context& context = Azure::Core::Context()) const; diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp index 722231611..e5a4c6197 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp @@ -338,7 +338,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * @brief Downloads only the bytes of the file from this range. */ - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; /** * @brief When specified together with Range, service returns hash for the range as long as the @@ -485,7 +485,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * @brief The range to be get from service. */ - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; /** * @brief The previous snapshot parameter is an opaque DateTime value that, when present, @@ -540,7 +540,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { /** * @brief Downloads only the bytes of the file from this range. */ - Azure::Core::Nullable Range; + Azure::Core::Nullable Range; struct { diff --git a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp index b6aa32f71..aa32f10eb 100644 --- a/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp +++ b/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_responses.hpp @@ -138,7 +138,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { struct DownloadShareFileResult { std::unique_ptr BodyStream; - Azure::Core::Http::Range ContentRange; + Azure::Core::Http::HttpRange ContentRange; int64_t FileSize = 0; Azure::Core::Nullable TransactionalContentHash; FileHttpHeaders HttpHeaders; @@ -168,7 +168,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { struct DownloadShareFileToResult { int64_t FileSize = 0; - Azure::Core::Http::Range ContentRange; + Azure::Core::Http::HttpRange ContentRange; FileHttpHeaders HttpHeaders; DownloadShareFileDetails Details; }; diff --git a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp index 0f17f22aa..b63beedb2 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_file_client.cpp @@ -277,7 +277,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { const HttpGetterInfo& retryInfo, const Azure::Core::Context& context) -> std::unique_ptr { DownloadShareFileOptions newOptions = options; - newOptions.Range = Core::Http::Range(); + newOptions.Range = Core::Http::HttpRange(); newOptions.Range.GetValue().Offset = (options.Range.HasValue() ? options.Range.GetValue().Offset : 0) + retryInfo.Offset; if (options.Range.HasValue() && options.Range.GetValue().Length.HasValue()) @@ -692,7 +692,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { auto downloadChunkFunc = [&](int64_t offset, int64_t length, int64_t chunkId, int64_t numChunks) { DownloadShareFileOptions chunkOptions; - chunkOptions.Range = Core::Http::Range(); + chunkOptions.Range = Core::Http::HttpRange(); chunkOptions.Range.GetValue().Offset = offset; chunkOptions.Range.GetValue().Length = length; auto chunk = Download(chunkOptions, context); @@ -809,7 +809,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { auto downloadChunkFunc = [&](int64_t offset, int64_t length, int64_t chunkId, int64_t numChunks) { DownloadShareFileOptions chunkOptions; - chunkOptions.Range = Core::Http::Range(); + chunkOptions.Range = Core::Http::HttpRange(); chunkOptions.Range.GetValue().Offset = offset; chunkOptions.Range.GetValue().Length = length; auto chunk = Download(chunkOptions, context); @@ -1051,7 +1051,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { Azure::Response ShareFileClient::UploadRangeFromUri( int64_t destinationOffset, const std::string& sourceUri, - const Azure::Core::Http::Range& sourceRange, + const Azure::Core::Http::HttpRange& sourceRange, const UploadFileRangeFromUriOptions& options, const Azure::Core::Context& context) const { diff --git a/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp b/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp index c4f6ef72f..8dee4cb7d 100644 --- a/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp +++ b/sdk/storage/azure-storage-files-shares/test/share_file_client_test.cpp @@ -430,7 +430,7 @@ namespace Azure { namespace Storage { namespace Test { options.TransferOptions.Concurrency = concurrency; if (offset.HasValue()) { - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = offset.GetValue(); options.Range.GetValue().Length = length; } @@ -500,7 +500,7 @@ namespace Azure { namespace Storage { namespace Test { options.TransferOptions.Concurrency = concurrency; if (offset.HasValue()) { - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = offset.GetValue(); options.Range.GetValue().Length = length; } @@ -583,7 +583,7 @@ namespace Azure { namespace Storage { namespace Test { // buffer not big enough Files::Shares::DownloadShareFileToOptions options; options.TransferOptions.Concurrency = c; - options.Range = Core::Http::Range(); + options.Range = Core::Http::HttpRange(); options.Range.GetValue().Offset = 1; for (int64_t length : {1ULL, 2ULL, 4_KB, 5_KB, 8_KB, 11_KB, 20_KB}) { @@ -629,7 +629,7 @@ namespace Azure { namespace Storage { namespace Test { for (int32_t i = 0; i < numOfChunks; ++i) { Files::Shares::DownloadShareFileOptions downloadOptions; - downloadOptions.Range = Core::Http::Range(); + downloadOptions.Range = Core::Http::HttpRange(); downloadOptions.Range.GetValue().Offset = static_cast(rangeSize) * i; downloadOptions.Range.GetValue().Length = rangeSize; Files::Shares::Models::DownloadShareFileResult result; @@ -845,8 +845,8 @@ namespace Azure { namespace Storage { namespace Test { auto destFileClient = m_shareClient->GetRootDirectoryClient().GetFileClient(RandomString(10)); destFileClient.Create(fileSize * 4); - Azure::Core::Http::Range sourceRange; - Azure::Core::Http::Range destRange; + Azure::Core::Http::HttpRange sourceRange; + Azure::Core::Http::HttpRange destRange; sourceRange.Length = fileSize; destRange.Offset = fileSize; destRange.Length = fileSize;