diff options
author | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-09-22 16:55:44 -0400 |
---|---|---|
committer | Kaloian Manassiev <kaloian.manassiev@mongodb.com> | 2016-09-22 17:56:07 -0400 |
commit | 63864ff42e0402b65f5fa45635b0a76baf671aa8 (patch) | |
tree | dc31e0eba898685de4ddd6f1fd30b0d7776c68b8 | |
parent | 0ef4cce98ab2bb45e2fa6e947014795148925d74 (diff) | |
download | mongo-63864ff42e0402b65f5fa45635b0a76baf671aa8.tar.gz |
SERVER-26248 Make IndexDescriptor string constants constexpr
-rw-r--r-- | src/mongo/db/index/index_descriptor.cpp | 24 | ||||
-rw-r--r-- | src/mongo/db/index/index_descriptor.h | 24 | ||||
-rw-r--r-- | src/mongo/db/namespace_string.cpp | 4 | ||||
-rw-r--r-- | src/mongo/db/namespace_string.h | 4 |
4 files changed, 28 insertions, 28 deletions
diff --git a/src/mongo/db/index/index_descriptor.cpp b/src/mongo/db/index/index_descriptor.cpp index 1f9e901dde6..fca84057727 100644 --- a/src/mongo/db/index/index_descriptor.cpp +++ b/src/mongo/db/index/index_descriptor.cpp @@ -70,18 +70,18 @@ void populateOptionsMap(std::map<StringData, BSONElement>& theMap, const BSONObj } } // namespace -const StringData IndexDescriptor::k2dsphereVersionFieldName = "2dsphereIndexVersion"_sd; -const StringData IndexDescriptor::kBackgroundFieldName = "background"_sd; -const StringData IndexDescriptor::kCollationFieldName = "collation"_sd; -const StringData IndexDescriptor::kDropDuplicatesFieldName = "dropDups"_sd; -const StringData IndexDescriptor::kIndexNameFieldName = "name"_sd; -const StringData IndexDescriptor::kIndexVersionFieldName = "v"_sd; -const StringData IndexDescriptor::kKeyPatternFieldName = "key"_sd; -const StringData IndexDescriptor::kNamespaceFieldName = "ns"_sd; -const StringData IndexDescriptor::kPartialFilterExprFieldName = "partialFilterExpression"_sd; -const StringData IndexDescriptor::kSparseFieldName = "sparse"_sd; -const StringData IndexDescriptor::kTextVersionFieldName = "textIndexVersion"_sd; -const StringData IndexDescriptor::kUniqueFieldName = "unique"_sd; +constexpr StringData IndexDescriptor::k2dsphereVersionFieldName; +constexpr StringData IndexDescriptor::kBackgroundFieldName; +constexpr StringData IndexDescriptor::kCollationFieldName; +constexpr StringData IndexDescriptor::kDropDuplicatesFieldName; +constexpr StringData IndexDescriptor::kIndexNameFieldName; +constexpr StringData IndexDescriptor::kIndexVersionFieldName; +constexpr StringData IndexDescriptor::kKeyPatternFieldName; +constexpr StringData IndexDescriptor::kNamespaceFieldName; +constexpr StringData IndexDescriptor::kPartialFilterExprFieldName; +constexpr StringData IndexDescriptor::kSparseFieldName; +constexpr StringData IndexDescriptor::kTextVersionFieldName; +constexpr StringData IndexDescriptor::kUniqueFieldName; bool IndexDescriptor::isIndexVersionSupported(IndexVersion indexVersion) { switch (indexVersion) { diff --git a/src/mongo/db/index/index_descriptor.h b/src/mongo/db/index/index_descriptor.h index 8263641958b..d271e7e5f5a 100644 --- a/src/mongo/db/index/index_descriptor.h +++ b/src/mongo/db/index/index_descriptor.h @@ -56,18 +56,18 @@ class IndexDescriptor { public: enum class IndexVersion { kV0 = 0, kV1 = 1, kV2 = 2 }; - static const StringData k2dsphereVersionFieldName; - static const StringData kBackgroundFieldName; - static const StringData kCollationFieldName; - static const StringData kDropDuplicatesFieldName; - static const StringData kIndexNameFieldName; - static const StringData kIndexVersionFieldName; - static const StringData kKeyPatternFieldName; - static const StringData kNamespaceFieldName; - static const StringData kPartialFilterExprFieldName; - static const StringData kSparseFieldName; - static const StringData kTextVersionFieldName; - static const StringData kUniqueFieldName; + static constexpr StringData k2dsphereVersionFieldName = "2dsphereIndexVersion"_sd; + static constexpr StringData kBackgroundFieldName = "background"_sd; + static constexpr StringData kCollationFieldName = "collation"_sd; + static constexpr StringData kDropDuplicatesFieldName = "dropDups"_sd; + static constexpr StringData kIndexNameFieldName = "name"_sd; + static constexpr StringData kIndexVersionFieldName = "v"_sd; + static constexpr StringData kKeyPatternFieldName = "key"_sd; + static constexpr StringData kNamespaceFieldName = "ns"_sd; + static constexpr StringData kPartialFilterExprFieldName = "partialFilterExpression"_sd; + static constexpr StringData kSparseFieldName = "sparse"_sd; + static constexpr StringData kTextVersionFieldName = "textIndexVersion"_sd; + static constexpr StringData kUniqueFieldName = "unique"_sd; /** * OnDiskIndexData is a pointer to the memory mapped per-index data. diff --git a/src/mongo/db/namespace_string.cpp b/src/mongo/db/namespace_string.cpp index f2eea383541..9779bdd4139 100644 --- a/src/mongo/db/namespace_string.cpp +++ b/src/mongo/db/namespace_string.cpp @@ -102,8 +102,8 @@ bool legalClientSystemNS(StringData ns) { return false; } -const StringData NamespaceString::kAdminDb = "admin"_sd; -const StringData NamespaceString::kLocalDb = "local"_sd; +constexpr StringData NamespaceString::kAdminDb; +constexpr StringData NamespaceString::kLocalDb; constexpr StringData NamespaceString::kSystemDotViewsCollectionName; const NamespaceString NamespaceString::kConfigCollectionNamespace(kConfigCollection); diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h index ce8bfa1884d..8bac89fb362 100644 --- a/src/mongo/db/namespace_string.h +++ b/src/mongo/db/namespace_string.h @@ -58,10 +58,10 @@ public: // Reserved system namespaces // Namespace for the admin database - static const StringData kAdminDb; + static constexpr StringData kAdminDb = "admin"_sd; // Namespace for the local database - static const StringData kLocalDb; + static constexpr StringData kLocalDb = "local"_sd; // Name for the system views collection static constexpr StringData kSystemDotViewsCollectionName = "system.views"_sd; |