From 8cae42999e9efe1bf49e78312dfe5069aa151ea4 Mon Sep 17 00:00:00 2001 From: JinmingHu Date: Fri, 27 Aug 2021 11:55:07 +0800 Subject: [PATCH] cspell for storage (#2800) * cspell for storage * aaa --- .vscode/cspell.json | 37 ++++++++----------- sdk/storage/MigrationGuide.md | 10 ++--- .../blobs/protocol/blob_rest_client.hpp | 2 + .../src/blob_sas_builder.cpp | 2 + .../test/ut/blob_container_client_test.cpp | 1 + .../inc/azure/storage/common/crypt.hpp | 2 +- .../azure-storage-common/src/crypt.cpp | 20 +++++----- .../azure-storage-common/test/test_base.hpp | 2 + .../src/datalake_sas_builder.cpp | 2 + .../test/datalake_directory_client_test.cpp | 2 + .../test/datalake_file_system_client_test.cpp | 1 + .../shares/protocol/share_rest_client.hpp | 2 + .../storage/files/shares/share_options.hpp | 2 + .../storage/files/shares/share_responses.hpp | 2 +- .../src/share_sas_builder.cpp | 2 + .../queues/protocol/queue_rest_client.hpp | 2 + .../test/ut/queue_client_test.cpp | 1 + 17 files changed, 53 insertions(+), 39 deletions(-) diff --git a/.vscode/cspell.json b/.vscode/cspell.json index 9d275bb56..62fe425de 100644 --- a/.vscode/cspell.json +++ b/.vscode/cspell.json @@ -17,8 +17,7 @@ "*nlohmann-json*", "sdk/identity/**/*", "sdk/core/**/*", - "sdk/keyvault/**/*", - "sdk/storage/**/*" + "sdk/keyvault/**/*" ], // * Unless configured otherwise, these words are not case sensitive // * Alphabetize the list when making changes so the list is easier for future @@ -109,24 +108,6 @@ "iname" ] }, - { - "filename": "**/sdk/storage/azure-storage-common/src/crypt.cpp", - "words": [ - "wdata" - ] - }, - { - "filename": "**/sdk/storage/azure-storage-files-shares/inc/azure/storage/files/shares/share_options.hpp", - "words": [ - "dacl" - ] - }, - { - "filename": "**/sdk/storage/azure-storage-blobs/inc/azure/storage/blobs/protocol/blob_rest_client.hpp", - "words": [ - "xmsblobsequencenumber" - ] - }, { "filename": "**/sdk/keyvault/azure-security-keyvault-keys/inc/azure/keyvault/keys/key_client_models.hpp", "words": [ @@ -135,9 +116,21 @@ ] }, { - "filename": "**/sdk/storage/azure-storage-common/test/test_base.hpp", + "filename": "**/sdk/storage/azure-storage-common/CHANGELOG.md", "words": [ - "FQJQ" + "johnwheffner", + "Heffner", + "lordgamez", + "Gabor", + "Gyimesi" + ] + }, + { + "filename": "**/sdk/storage/test-resources.json", + "words": [ + "bfqt", + "rwdlacup", + "pfile" ] } ], diff --git a/sdk/storage/MigrationGuide.md b/sdk/storage/MigrationGuide.md index fc1be9178..8c3199103 100644 --- a/sdk/storage/MigrationGuide.md +++ b/sdk/storage/MigrationGuide.md @@ -137,7 +137,7 @@ If you wish to rotate the key within your `BlobServiceClient` (and any derived c **The legacy SDK used a stateful model.** There were container and blob objects that held state regarding service resources and required the user to manually call their update methods. But blob contents were not a part of this state and had to be uploaded/downloaded whenever they were to be interacted with. This became increasingly confusing over time, and increasingly susceptible to thread safety issues. -The modern SDK has taken a client-based approach. There are no objects designed to be representations of storage resources, but instead clients that act as your mechanism to interact with your storage resources in the cloud. **Clients hold no state of your resources.** (Lease client is an exception.) This is most noticable when looking at [blob metadata](#managing-blob-metadata). +The modern SDK has taken a client-based approach. There are no objects designed to be representations of storage resources, but instead clients that act as your mechanism to interact with your storage resources in the cloud. **Clients hold no state of your resources.** (Lease client is an exception.) This is most noticeable when looking at [blob metadata](#managing-blob-metadata). The hierarchical structure of Azure Blob Storage can be understood by the following diagram: ![Blob Storage Hierarchy](https://docs.microsoft.com/azure/storage/blobs/media/storage-blobs-introduction/blob1.png) @@ -148,7 +148,7 @@ In the interest of simplifying the API surface, v12 uses three top level clients Note the absence of a v12 equivalent for v7.5's `cloud_blob_directory`. Directories were an SDK-only concept that did not exist in Azure Blob Storage, and which were not brought forwards into the modern Storage SDK. As shown by the diagram in [Client Structure](#client-structure), containers only contain a flat list of blobs, but those blobs can be named and listed in ways that imply a folder-like structure. See our [Listing Blobs in a Container](#listing-blobs-in-a-container) migration samples later in this guide for more information. -For those whose workloads revolve around manipulating directories and heavily relied on the leagacy SDKs abstraction of this structure, consider the [pros and cons of enabling hierarchical namespace](https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-namespace) on your storage account, which would allow switching to the [Data Lake Gen 2 SDK](https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/storage/azure-storage-files-datalake), whose migration is not covered in this document. +For those whose workloads revolve around manipulating directories and heavily relied on the legacy SDKs abstraction of this structure, consider the [pros and cons of enabling hierarchical namespace](https://docs.microsoft.com/azure/storage/blobs/data-lake-storage-namespace) on your storage account, which would allow switching to the [Data Lake Gen 2 SDK](https://github.com/Azure/azure-sdk-for-cpp/tree/main/sdk/storage/azure-storage-files-datalake), whose migration is not covered in this document. #### Class Conversion Reference @@ -350,7 +350,7 @@ blob_client.download_to_file(local_file_path); // modify blob content -// reupload modified blob content while preserving metadata +// re-upload modified blob content while preserving metadata blob_client.upload_from_file(local_file_path); ``` @@ -364,7 +364,7 @@ metadata["foo"] = "bar"; blobClient.SetMetadata(metadata); ``` -Additionally with blob content edits, if your blobs have metadata you need to get the metadata and reupload with that metadata, telling the service what metadata goes with this new blob state. +Additionally with blob content edits, if your blobs have metadata you need to get the metadata and re-upload with that metadata, telling the service what metadata goes with this new blob state. ```C++ // download blob content and metadata @@ -373,7 +373,7 @@ auto metadata = response.Value.Metadata; // modify blob content -// reupload modified blob content while preserving metadata +// re-upload modified blob content while preserving metadata // not adding metadata is a metadata clear UploadBlockBlobFromOptions uploadOptions; uploadOptions.Metadata = metadata; 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 1aa3bc387..6cad66786 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 @@ -23,6 +23,8 @@ #include "azure/storage/blobs/dll_import_export.hpp" +/* cSpell:disable */ + namespace Azure { namespace Storage { namespace Blobs { namespace Models { diff --git a/sdk/storage/azure-storage-blobs/src/blob_sas_builder.cpp b/sdk/storage/azure-storage-blobs/src/blob_sas_builder.cpp index c6e281910..fdce70cc7 100644 --- a/sdk/storage/azure-storage-blobs/src/blob_sas_builder.cpp +++ b/sdk/storage/azure-storage-blobs/src/blob_sas_builder.cpp @@ -6,6 +6,8 @@ #include #include +/* cSpell:ignore rscc, rscd, rsce, rscl, rsct, skoid, sktid */ + namespace Azure { namespace Storage { namespace Sas { namespace { diff --git a/sdk/storage/azure-storage-blobs/test/ut/blob_container_client_test.cpp b/sdk/storage/azure-storage-blobs/test/ut/blob_container_client_test.cpp index f1ee1ba30..fbe4d0338 100644 --- a/sdk/storage/azure-storage-blobs/test/ut/blob_container_client_test.cpp +++ b/sdk/storage/azure-storage-blobs/test/ut/blob_container_client_test.cpp @@ -390,6 +390,7 @@ namespace Azure { namespace Storage { namespace Test { identifier.Id = RandomString(64); identifier.StartsOn = std::chrono::system_clock::now() - std::chrono::minutes(2); identifier.ExpiresOn = std::chrono::system_clock::now() + std::chrono::minutes(2); + /* cspell:disable-next-line */ identifier.Permissions = "racwdxlt"; options.SignedIdentifiers.emplace_back(identifier); diff --git a/sdk/storage/azure-storage-common/inc/azure/storage/common/crypt.hpp b/sdk/storage/azure-storage-common/inc/azure/storage/common/crypt.hpp index 2fa745b49..f1eed98ad 100644 --- a/sdk/storage/azure-storage-common/inc/azure/storage/common/crypt.hpp +++ b/sdk/storage/azure-storage-common/inc/azure/storage/common/crypt.hpp @@ -20,7 +20,7 @@ namespace Azure { namespace Storage { public: /** * @brief Concatenates another #Crc64 instance after this instance. This operation has the same - * effect as if the data in the other instance was appened to this instance. + * effect as if the data in the other instance was append to this instance. * * @param other Another #Crc64Hash instance to be concatenated after this instance. */ diff --git a/sdk/storage/azure-storage-common/src/crypt.cpp b/sdk/storage/azure-storage-common/src/crypt.cpp index 8a622a994..f09d2718e 100644 --- a/sdk/storage/azure-storage-common/src/crypt.cpp +++ b/sdk/storage/azure-storage-common/src/crypt.cpp @@ -866,7 +866,7 @@ namespace Azure { namespace Storage { size_t uStop = length - (length % 32); if (uStop >= 2 * 32) { - const uint64_t* wdata = reinterpret_cast(data); + const uint64_t* wData = reinterpret_cast(data); uint64_t uCrc0 = 0; uint64_t uCrc1 = 0; @@ -876,12 +876,12 @@ namespace Azure { namespace Storage { length -= uStop; uCrc0 = uCrc; - for (; pData < pLast; pData += 32, wdata += 4) + for (; pData < pLast; pData += 32, wData += 4) { - uint64_t b0 = wdata[0] ^ uCrc0; - uint64_t b1 = wdata[1] ^ uCrc1; - uint64_t b2 = wdata[2] ^ uCrc2; - uint64_t b3 = wdata[3] ^ uCrc3; + uint64_t b0 = wData[0] ^ uCrc0; + uint64_t b1 = wData[1] ^ uCrc1; + uint64_t b2 = wData[2] ^ uCrc2; + uint64_t b3 = wData[3] ^ uCrc3; uCrc0 = Crc64MU32[7 * 256 + (b0 & 0xff)]; b0 >>= 8; @@ -953,7 +953,7 @@ namespace Azure { namespace Storage { } uCrc = 0; - uCrc ^= wdata[0] ^ uCrc0; + uCrc ^= wData[0] ^ uCrc0; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; @@ -963,7 +963,7 @@ namespace Azure { namespace Storage { uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; - uCrc ^= wdata[1] ^ uCrc1; + uCrc ^= wData[1] ^ uCrc1; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; @@ -973,7 +973,7 @@ namespace Azure { namespace Storage { uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; - uCrc ^= wdata[2] ^ uCrc2; + uCrc ^= wData[2] ^ uCrc2; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; @@ -983,7 +983,7 @@ namespace Azure { namespace Storage { uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; - uCrc ^= wdata[3] ^ uCrc3; + uCrc ^= wData[3] ^ uCrc3; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; uCrc = (uCrc >> 8) ^ Crc64MU1[uCrc & 0xff]; diff --git a/sdk/storage/azure-storage-common/test/test_base.hpp b/sdk/storage/azure-storage-common/test/test_base.hpp index 80cb73a7f..319bcfbcc 100644 --- a/sdk/storage/azure-storage-common/test/test_base.hpp +++ b/sdk/storage/azure-storage-common/test/test_base.hpp @@ -53,7 +53,9 @@ namespace Azure { namespace Storage { const static Azure::ETag DummyETag("0x8D83B58BDF51D75"); const static Azure::ETag DummyETag2("0x8D812645BFB0CDE"); + /* cspell:disable-next-line */ constexpr static const char* DummyMd5 = "tQbD1aMPeB+LiPffUwFQJQ=="; + /* cspell:disable-next-line */ constexpr static const char* DummyCrc64 = "+DNR5PON4EM="; uint64_t RandomInt( diff --git a/sdk/storage/azure-storage-files-datalake/src/datalake_sas_builder.cpp b/sdk/storage/azure-storage-files-datalake/src/datalake_sas_builder.cpp index 22c76eff3..049d2e09c 100644 --- a/sdk/storage/azure-storage-files-datalake/src/datalake_sas_builder.cpp +++ b/sdk/storage/azure-storage-files-datalake/src/datalake_sas_builder.cpp @@ -6,6 +6,8 @@ #include #include +/* cSpell:ignore rscc, rscd, rsce, rscl, rsct, skoid, sktid, saoid, suoid, scid */ + namespace Azure { namespace Storage { namespace Sas { namespace { std::string DataLakeSasResourceToString(DataLakeSasResource resource) diff --git a/sdk/storage/azure-storage-files-datalake/test/datalake_directory_client_test.cpp b/sdk/storage/azure-storage-files-datalake/test/datalake_directory_client_test.cpp index 327ab60b3..aa5688f38 100644 --- a/sdk/storage/azure-storage-files-datalake/test/datalake_directory_client_test.cpp +++ b/sdk/storage/azure-storage-files-datalake/test/datalake_directory_client_test.cpp @@ -302,7 +302,9 @@ namespace Azure { namespace Storage { namespace Test { EXPECT_NO_THROW(client1.Create(options1)); EXPECT_NO_THROW(client2.Create(options2)); auto result = client1.GetProperties().Value.Metadata; + /* cspell:disable-next-line */ metadata1["hdi_isfolder"] = "true"; + /* cspell:disable-next-line */ metadata2["hdi_isfolder"] = "true"; EXPECT_EQ(metadata1, result); result = client2.GetProperties().Value.Metadata; diff --git a/sdk/storage/azure-storage-files-datalake/test/datalake_file_system_client_test.cpp b/sdk/storage/azure-storage-files-datalake/test/datalake_file_system_client_test.cpp index f949d1d47..7b34d17b4 100644 --- a/sdk/storage/azure-storage-files-datalake/test/datalake_file_system_client_test.cpp +++ b/sdk/storage/azure-storage-files-datalake/test/datalake_file_system_client_test.cpp @@ -370,6 +370,7 @@ namespace Azure { namespace Storage { namespace Test { identifier.Id = RandomString(64); identifier.StartsOn = std::chrono::system_clock::now() - std::chrono::minutes(2); identifier.ExpiresOn = std::chrono::system_clock::now() + std::chrono::minutes(2); + /* cspell:disable-next-line */ identifier.Permissions = "racwdxlt"; options.SignedIdentifiers.emplace_back(identifier); 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 aa5cd7b22..0faad0334 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 @@ -27,6 +27,8 @@ #include #include +/* cSpell:disable */ + namespace Azure { namespace Storage { namespace Files { namespace Shares { namespace Models { 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 5d75f881b..b543f9a0b 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 @@ -13,6 +13,8 @@ #include "azure/storage/files/shares/protocol/share_rest_client.hpp" +/* cSpell:ignore dacl */ + namespace Azure { namespace Storage { namespace Files { namespace Shares { /** 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 301b7f3c5..2f8ceb358 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 @@ -399,7 +399,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares { */ int32_t NumberOfHandlesClosed = 0; /** - * Number of file handles that fialed to close. + * Number of file handles that failed to close. */ int32_t NumberOfHandlesFailedToClose = 0; diff --git a/sdk/storage/azure-storage-files-shares/src/share_sas_builder.cpp b/sdk/storage/azure-storage-files-shares/src/share_sas_builder.cpp index cc94d4298..9d6eec47d 100644 --- a/sdk/storage/azure-storage-files-shares/src/share_sas_builder.cpp +++ b/sdk/storage/azure-storage-files-shares/src/share_sas_builder.cpp @@ -6,6 +6,8 @@ #include #include +/* cSpell:ignore rscc, rscd, rsce, rscl, rsct */ + namespace Azure { namespace Storage { namespace Sas { namespace { diff --git a/sdk/storage/azure-storage-queues/inc/azure/storage/queues/protocol/queue_rest_client.hpp b/sdk/storage/azure-storage-queues/inc/azure/storage/queues/protocol/queue_rest_client.hpp index cf4b7b86d..6a853abd2 100644 --- a/sdk/storage/azure-storage-queues/inc/azure/storage/queues/protocol/queue_rest_client.hpp +++ b/sdk/storage/azure-storage-queues/inc/azure/storage/queues/protocol/queue_rest_client.hpp @@ -21,6 +21,8 @@ #include "azure/storage/queues/dll_import_export.hpp" +/* cSpell:disable */ + namespace Azure { namespace Storage { namespace Queues { namespace Models { diff --git a/sdk/storage/azure-storage-queues/test/ut/queue_client_test.cpp b/sdk/storage/azure-storage-queues/test/ut/queue_client_test.cpp index 65ad47865..f9d7b3f81 100644 --- a/sdk/storage/azure-storage-queues/test/ut/queue_client_test.cpp +++ b/sdk/storage/azure-storage-queues/test/ut/queue_client_test.cpp @@ -139,6 +139,7 @@ namespace Azure { namespace Storage { namespace Test { identifier.Id = RandomString(64); identifier.StartsOn = std::chrono::system_clock::now() - std::chrono::minutes(2); identifier.ExpiresOn = std::chrono::system_clock::now() + std::chrono::minutes(2); + /* cspell:disable-next-line */ identifier.Permissions = "raup"; signedIdentifiers.emplace_back(identifier);