summaryrefslogtreecommitdiff
path: root/src/mongo/db/namespace_string.h
diff options
context:
space:
mode:
authorTommaso Tocci <tommaso.tocci@mongodb.com>2023-04-24 15:46:56 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-04-24 17:10:29 +0000
commitfc7d81d0f3cad9978bf69097b2a9dc3bbe3a0026 (patch)
treee736e2bf16d0a80d4b052abf9214b20858caed9e /src/mongo/db/namespace_string.h
parent9bdae80d0e77cd0c582185df528e4c356ebfa9bd (diff)
downloadmongo-fc7d81d0f3cad9978bf69097b2a9dc3bbe3a0026.tar.gz
SERVER-76396 Refactor special database constant handling
Diffstat (limited to 'src/mongo/db/namespace_string.h')
-rw-r--r--src/mongo/db/namespace_string.h19
1 files changed, 6 insertions, 13 deletions
diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h
index 7ff360eee42..026f6f941ed 100644
--- a/src/mongo/db/namespace_string.h
+++ b/src/mongo/db/namespace_string.h
@@ -165,7 +165,6 @@ public:
// Prefix for orphan collections
static constexpr StringData kOrphanCollectionPrefix = "orphan."_sd;
- static constexpr StringData kOrphanCollectionDb = "local"_sd;
// Prefix for collections that store the local resharding oplog buffer.
static constexpr StringData kReshardingLocalOplogBufferPrefix =
@@ -468,13 +467,13 @@ public:
//
bool isHealthlog() const {
- return isLocal() && coll() == "system.healthlog";
+ return isLocalDB() && coll() == "system.healthlog";
}
bool isSystem() const {
return coll().startsWith("system.");
}
bool isNormalCollection() const {
- return !isSystem() && !(isLocal() && coll().startsWith("replset."));
+ return !isSystem() && !(isLocalDB() && coll().startsWith("replset."));
}
bool isGlobalIndex() const {
return coll().startsWith(kGlobalIndexCollectionPrefix);
@@ -482,7 +481,7 @@ public:
bool isAdminDB() const {
return db() == DatabaseName::kAdmin.db();
}
- bool isLocal() const {
+ bool isLocalDB() const {
return db() == DatabaseName::kLocal.db();
}
bool isSystemDotProfile() const {
@@ -499,7 +498,7 @@ public:
return coll() == kSystemDotJavascriptCollectionName;
}
bool isServerConfigurationCollection() const {
- return (db() == DatabaseName::kAdmin.db()) && (coll() == "system.version");
+ return isAdminDB() && (coll() == "system.version");
}
bool isPrivilegeCollection() const {
if (!isAdminDB()) {
@@ -517,17 +516,11 @@ public:
return oplog(_ns);
}
bool isOnInternalDb() const {
- if (db() == DatabaseName::kAdmin.db())
- return true;
- if (db() == DatabaseName::kLocal.db())
- return true;
- if (db() == DatabaseName::kConfig.db())
- return true;
- return false;
+ return isAdminDB() || isLocalDB() || isConfigDB();
}
bool isOrphanCollection() const {
- return db() == kOrphanCollectionDb && coll().startsWith(kOrphanCollectionPrefix);
+ return isLocalDB() && coll().startsWith(kOrphanCollectionPrefix);
}
/**