Remove c_ for constants. (#1491)

* Remove c_ for constants.

* Update CHANGELOG.md
This commit is contained in:
Kan Tang 2021-01-27 07:03:29 -08:00 committed by GitHub
parent 288d1c7652
commit ecbead7761
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 63 additions and 58 deletions

View File

@ -9,16 +9,16 @@
namespace Azure { namespace Storage { namespace Files { namespace DataLake { namespace Details {
const static std::string c_DfsEndPointIdentifier = ".dfs.";
const static std::string c_BlobEndPointIdentifier = ".blob.";
const static std::string DfsEndPointIdentifier = ".dfs.";
const static std::string BlobEndPointIdentifier = ".blob.";
std::string GetBlobUrlFromUrl(const std::string& url)
{
std::string result = url;
auto pos = result.find(c_DfsEndPointIdentifier);
auto pos = result.find(DfsEndPointIdentifier);
if (pos != std::string::npos)
{
result.replace(pos, c_DfsEndPointIdentifier.size(), c_BlobEndPointIdentifier);
result.replace(pos, DfsEndPointIdentifier.size(), BlobEndPointIdentifier);
}
return result;
}
@ -26,10 +26,10 @@ namespace Azure { namespace Storage { namespace Files { namespace DataLake { nam
std::string GetDfsUrlFromUrl(const std::string& url)
{
std::string result = url;
auto pos = result.find(c_BlobEndPointIdentifier);
auto pos = result.find(BlobEndPointIdentifier);
if (pos != std::string::npos)
{
result.replace(pos, c_BlobEndPointIdentifier.size(), c_DfsEndPointIdentifier);
result.replace(pos, BlobEndPointIdentifier.size(), DfsEndPointIdentifier);
}
return result;
}

View File

@ -10,7 +10,7 @@
namespace Azure { namespace Storage { namespace Test {
const size_t c_PATH_TEST_SIZE = 5;
const size_t PathTestSize = 5;
std::shared_ptr<Files::DataLake::DataLakeFileSystemClient>
DataLakeFileSystemClientTest::m_fileSystemClient;
@ -33,7 +33,7 @@ namespace Azure { namespace Storage { namespace Test {
m_directoryB = LowercaseRandomString();
m_pathNameSetA.clear();
m_pathNameSetB.clear();
for (size_t i = 0; i < c_PATH_TEST_SIZE; ++i)
for (size_t i = 0; i < PathTestSize; ++i)
{
{
auto name = m_directoryA + "/" + LowercaseRandomString();

View File

@ -8,7 +8,7 @@
namespace Azure { namespace Storage { namespace Test {
const size_t c_FILE_SYSTEM_TEST_SIZE = 5;
const size_t FileSystemTestSize = 5;
std::shared_ptr<Files::DataLake::DataLakeServiceClient>
DataLakeServiceClientTest::m_dataLakeServiceClient;
@ -26,7 +26,7 @@ namespace Azure { namespace Storage { namespace Test {
m_fileSystemPrefixB = LowercaseRandomString(10);
m_fileSystemNameSetA.clear();
m_fileSystemNameSetB.clear();
for (size_t i = 0; i < c_FILE_SYSTEM_TEST_SIZE; ++i)
for (size_t i = 0; i < FileSystemTestSize; ++i)
{
{
auto name = m_fileSystemPrefixA + LowercaseRandomString(10);

View File

@ -14,6 +14,11 @@
- Added `ShareLeaseClient`, all lease related APIs are moved to `ShareLeaseClient`.
- Changed lease duration to be `std::chrono::seconds`.
- Added `RequestId` in each return types for REST API calls, except for concurrent APIs.
- Removed `c_` for constants: `c_FileDefaultTimeValue`, `c_FileCopySourceTime`, `c_FileInheritPermission`, `FilePreserveSmbProperties` and `FileAllHandles`.
### Other Changes and Improvements
- Removed `c_` for constants and renamed to pascal format.
## 12.0.0-beta.6 (2020-01-14)

View File

@ -6,16 +6,16 @@
namespace Azure { namespace Storage { namespace Files { namespace Shares {
constexpr static const char* c_FileDefaultTimeValue = "now";
constexpr static const char* c_FileCopySourceTime = "source";
constexpr static const char* c_FileInheritPermission = "inherit";
constexpr static const char* c_FilePreserveSmbProperties = "preserve";
constexpr static const char* c_FileAllHandles = "*";
constexpr static const char* FileDefaultTimeValue = "now";
constexpr static const char* FileCopySourceTime = "source";
constexpr static const char* FileInheritPermission = "inherit";
constexpr static const char* FilePreserveSmbProperties = "preserve";
constexpr static const char* FileAllHandles = "*";
namespace Details {
constexpr int64_t c_FileUploadDefaultChunkSize = 4 * 1024 * 1024;
constexpr int64_t c_FileDownloadDefaultChunkSize = 4 * 1024 * 1024;
constexpr static const char* c_ShareSnapshotQueryParameter = "sharesnapshot";
constexpr int64_t FileUploadDefaultChunkSize = 4 * 1024 * 1024;
constexpr int64_t FileDownloadDefaultChunkSize = 4 * 1024 * 1024;
constexpr static const char* ShareSnapshotQueryParameter = "sharesnapshot";
// Error codes:
constexpr static const char* ParentNotFound = "ParentNotFound";

View File

@ -98,12 +98,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
ShareClient newClient(*this);
if (snapshot.empty())
{
newClient.m_shareUrl.RemoveQueryParameter(Details::c_ShareSnapshotQueryParameter);
newClient.m_shareUrl.RemoveQueryParameter(Details::ShareSnapshotQueryParameter);
}
else
{
newClient.m_shareUrl.AppendQueryParameter(
Details::c_ShareSnapshotQueryParameter,
Details::ShareSnapshotQueryParameter,
Storage::Details::UrlEncodeQueryParameter(snapshot));
}
return newClient;

View File

@ -112,12 +112,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
ShareDirectoryClient newClient(*this);
if (shareSnapshot.empty())
{
newClient.m_shareDirectoryUrl.RemoveQueryParameter(Details::c_ShareSnapshotQueryParameter);
newClient.m_shareDirectoryUrl.RemoveQueryParameter(Details::ShareSnapshotQueryParameter);
}
else
{
newClient.m_shareDirectoryUrl.AppendQueryParameter(
Details::c_ShareSnapshotQueryParameter,
Details::ShareSnapshotQueryParameter,
Storage::Details::UrlEncodeQueryParameter(shareSnapshot));
}
return newClient;
@ -143,7 +143,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileCreationTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileCreationTime = std::string(FileDefaultTimeValue);
}
if (options.SmbProperties.LastWrittenOn.HasValue())
{
@ -153,7 +153,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileLastWriteTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileLastWriteTime = std::string(FileDefaultTimeValue);
}
if (options.DirectoryPermission.HasValue())
{
@ -165,7 +165,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FilePermission = std::string(c_FileInheritPermission);
protocolLayerOptions.FilePermission = std::string(FileInheritPermission);
}
auto result = Details::ShareRestClient::Directory::Create(
m_shareDirectoryUrl, *m_pipeline, options.Context, protocolLayerOptions);
@ -265,7 +265,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileCreationTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileCreationTime = std::string(FileDefaultTimeValue);
}
if (smbProperties.LastWrittenOn.HasValue())
{
@ -275,7 +275,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileLastWriteTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileLastWriteTime = std::string(FileDefaultTimeValue);
}
if (options.FilePermission.HasValue())
{
@ -287,7 +287,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FilePermission = std::string(c_FileInheritPermission);
protocolLayerOptions.FilePermission = std::string(FileInheritPermission);
}
return Details::ShareRestClient::Directory::SetProperties(
m_shareDirectoryUrl, *m_pipeline, options.Context, protocolLayerOptions);
@ -366,7 +366,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
const ForceCloseAllShareDirectoryHandlesOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::Directory::ForceCloseHandlesOptions();
protocolLayerOptions.HandleId = c_FileAllHandles;
protocolLayerOptions.HandleId = FileAllHandles;
protocolLayerOptions.ContinuationToken = options.ContinuationToken;
protocolLayerOptions.Recursive = options.Recursive;
return Details::ShareRestClient::Directory::ForceCloseHandles(

View File

@ -99,12 +99,12 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
ShareFileClient newClient(*this);
if (shareSnapshot.empty())
{
newClient.m_shareFileUrl.RemoveQueryParameter(Details::c_ShareSnapshotQueryParameter);
newClient.m_shareFileUrl.RemoveQueryParameter(Details::ShareSnapshotQueryParameter);
}
else
{
newClient.m_shareFileUrl.AppendQueryParameter(
Details::c_ShareSnapshotQueryParameter,
Details::ShareSnapshotQueryParameter,
Storage::Details::UrlEncodeQueryParameter(shareSnapshot));
}
return newClient;
@ -131,7 +131,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileCreationTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileCreationTime = std::string(FileDefaultTimeValue);
}
if (options.SmbProperties.LastWrittenOn.HasValue())
{
@ -141,7 +141,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileLastWriteTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileLastWriteTime = std::string(FileDefaultTimeValue);
}
if (options.Permission.HasValue())
{
@ -153,7 +153,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FilePermission = std::string(c_FileInheritPermission);
protocolLayerOptions.FilePermission = std::string(FileInheritPermission);
}
protocolLayerOptions.XMsContentLength = fileSize;
if (!options.HttpHeaders.ContentType.empty())
@ -320,7 +320,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileCopyFileCreationTime = std::string(c_FileCopySourceTime);
protocolLayerOptions.FileCopyFileCreationTime = std::string(FileCopySourceTime);
}
if (options.SmbProperties.LastWrittenOn.HasValue())
{
@ -330,7 +330,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileCopyFileLastWriteTime = std::string(c_FileCopySourceTime);
protocolLayerOptions.FileCopyFileLastWriteTime = std::string(FileCopySourceTime);
}
if (options.PermissionCopyMode.HasValue())
{
@ -403,7 +403,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileCreationTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileCreationTime = std::string(FileDefaultTimeValue);
}
if (smbProperties.LastWrittenOn.HasValue())
{
@ -413,7 +413,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileLastWriteTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileLastWriteTime = std::string(FileDefaultTimeValue);
}
protocolLayerOptions.XMsContentLength = options.Size;
protocolLayerOptions.LeaseIdOptional = options.AccessConditions.LeaseId;
@ -427,7 +427,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FilePermission = std::string(c_FileInheritPermission);
protocolLayerOptions.FilePermission = std::string(FileInheritPermission);
}
if (!httpHeaders.ContentType.empty())
@ -565,7 +565,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
ShareFileClient::ForceCloseAllHandles(const ForceCloseAllShareFileHandlesOptions& options) const
{
auto protocolLayerOptions = Details::ShareRestClient::File::ForceCloseHandlesOptions();
protocolLayerOptions.HandleId = c_FileAllHandles;
protocolLayerOptions.HandleId = FileAllHandles;
protocolLayerOptions.ContinuationToken = options.ContinuationToken;
return Details::ShareRestClient::File::ForceCloseHandles(
m_shareFileUrl, *m_pipeline, options.Context, protocolLayerOptions);
@ -580,7 +580,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
// thing in one shot. If it's a large file, we'll get its full size in Content-Range and can
// keep downloading it in chunks.
int64_t firstChunkOffset = options.Range.HasValue() ? options.Range.GetValue().Offset : 0;
int64_t firstChunkLength = Details::c_FileDownloadDefaultChunkSize;
int64_t firstChunkLength = Details::FileDownloadDefaultChunkSize;
if (options.InitialChunkSize.HasValue())
{
firstChunkLength = options.InitialChunkSize.GetValue();
@ -679,10 +679,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
int64_t c_grainSize = 4 * 1024;
int64_t GrainSize = 4 * 1024;
chunkSize = remainingSize / options.Concurrency;
chunkSize = (std::max(chunkSize, int64_t(1)) + c_grainSize - 1) / c_grainSize * c_grainSize;
chunkSize = std::min(chunkSize, Details::c_FileDownloadDefaultChunkSize);
chunkSize = (std::max(chunkSize, int64_t(1)) + GrainSize - 1) / GrainSize * GrainSize;
chunkSize = std::min(chunkSize, Details::FileDownloadDefaultChunkSize);
}
Storage::Details::ConcurrentTransfer(
@ -699,7 +699,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
// thing in one shot. If it's a large file, we'll get its full size in Content-Range and can
// keep downloading it in chunks.
int64_t firstChunkOffset = options.Range.HasValue() ? options.Range.GetValue().Offset : 0;
int64_t firstChunkLength = Details::c_FileDownloadDefaultChunkSize;
int64_t firstChunkLength = Details::FileDownloadDefaultChunkSize;
if (options.InitialChunkSize.HasValue())
{
firstChunkLength = options.InitialChunkSize.GetValue();
@ -809,10 +809,10 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
int64_t c_grainSize = 4 * 1024;
int64_t GrainSize = 4 * 1024;
chunkSize = remainingSize / options.Concurrency;
chunkSize = (std::max(chunkSize, int64_t(1)) + c_grainSize - 1) / c_grainSize * c_grainSize;
chunkSize = std::min(chunkSize, Details::c_FileDownloadDefaultChunkSize);
chunkSize = (std::max(chunkSize, int64_t(1)) + GrainSize - 1) / GrainSize * GrainSize;
chunkSize = std::min(chunkSize, Details::FileDownloadDefaultChunkSize);
}
Storage::Details::ConcurrentTransfer(
@ -843,7 +843,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileCreationTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileCreationTime = std::string(FileDefaultTimeValue);
}
if (options.SmbProperties.LastWrittenOn.HasValue())
{
@ -853,7 +853,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileLastWriteTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileLastWriteTime = std::string(FileDefaultTimeValue);
}
if (options.FilePermission.HasValue())
{
@ -865,7 +865,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FilePermission = std::string(c_FileInheritPermission);
protocolLayerOptions.FilePermission = std::string(FileInheritPermission);
}
if (!options.HttpHeaders.ContentType.empty())
@ -901,7 +901,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUrl, *m_pipeline, options.Context, protocolLayerOptions);
int64_t chunkSize = options.ChunkSize.HasValue() ? options.ChunkSize.GetValue()
: Details::c_FileUploadDefaultChunkSize;
: Details::FileUploadDefaultChunkSize;
auto uploadPageFunc = [&](int64_t offset, int64_t length, int64_t chunkId, int64_t numChunks) {
unused(chunkId, numChunks);
@ -943,7 +943,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileCreationTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileCreationTime = std::string(FileDefaultTimeValue);
}
if (options.SmbProperties.LastWrittenOn.HasValue())
{
@ -953,7 +953,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FileLastWriteTime = std::string(c_FileDefaultTimeValue);
protocolLayerOptions.FileLastWriteTime = std::string(FileDefaultTimeValue);
}
if (options.FilePermission.HasValue())
{
@ -965,7 +965,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
}
else
{
protocolLayerOptions.FilePermission = std::string(c_FileInheritPermission);
protocolLayerOptions.FilePermission = std::string(FileInheritPermission);
}
if (!options.HttpHeaders.ContentType.empty())
@ -1001,7 +1001,7 @@ namespace Azure { namespace Storage { namespace Files { namespace Shares {
m_shareFileUrl, *m_pipeline, options.Context, protocolLayerOptions);
int64_t chunkSize = options.ChunkSize.HasValue() ? options.ChunkSize.GetValue()
: Details::c_FileUploadDefaultChunkSize;
: Details::FileUploadDefaultChunkSize;
auto uploadPageFunc = [&](int64_t offset, int64_t length, int64_t chunkId, int64_t numChunks) {
unused(chunkId, numChunks);

View File

@ -18,7 +18,7 @@ namespace Azure { namespace Storage { namespace Test {
}
} // namespace
const size_t c_SHARE_TEST_SIZE = 5;
const size_t ShareTestSize = 5;
std::shared_ptr<Files::Shares::ShareServiceClient>
FileShareServiceClientTest::m_fileShareServiceClient;
@ -36,7 +36,7 @@ namespace Azure { namespace Storage { namespace Test {
m_sharePrefixB = LowercaseRandomString(10);
m_shareNameSetA.clear();
m_shareNameSetB.clear();
for (size_t i = 0; i < c_SHARE_TEST_SIZE; ++i)
for (size_t i = 0; i < ShareTestSize; ++i)
{
{
auto name = m_sharePrefixA + LowercaseRandomString(10);