summaryrefslogtreecommitdiff
path: root/src/mongo/db/namespace_string.h
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-08-08 17:47:33 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2016-08-12 11:59:59 -0400
commit0c6bbea55ee45db0813043b470246fc62501a38c (patch)
treeb16f142b0ab05e297d42a9f99b3e76b6da280f07 /src/mongo/db/namespace_string.h
parente0bd06f4aab2995bac09e7ef0b25ba47ad2cb97e (diff)
downloadmongo-0c6bbea55ee45db0813043b470246fc62501a38c.tar.gz
SERVER-25202 Support parallel manual chunk migrations
This change switches the MigrationManager to use the UsedResourcesMap class for acquiring the collection distributed lock on first migration attempt and dropping it on the last. This allows it to support parallel manual migrations.
Diffstat (limited to 'src/mongo/db/namespace_string.h')
-rw-r--r--src/mongo/db/namespace_string.h30
1 files changed, 10 insertions, 20 deletions
diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h
index bfab52bb92e..00ef04c4249 100644
--- a/src/mongo/db/namespace_string.h
+++ b/src/mongo/db/namespace_string.h
@@ -35,6 +35,7 @@
#include <string>
#include "mongo/base/string_data.h"
+#include "mongo/platform/hash_namespace.h"
#include "mongo/util/assert_util.h"
namespace mongo {
@@ -368,31 +369,20 @@ inline bool nsIsDbOnly(StringData ns) {
}
/**
- * NamespaceDBHash and NamespaceDBEquals allow you to do something like
- * unordered_map<std::string,int,NamespaceDBHash,NamespaceDBEquals>
- * and use the full namespace for the string
- * but comparisons are done only on the db piece
- */
-
-/**
* this can change, do not store on disk
*/
int nsDBHash(const std::string& ns);
-bool nsDBEquals(const std::string& a, const std::string& b);
+} // namespace mongo
-struct NamespaceDBHash {
- int operator()(const std::string& ns) const {
- return nsDBHash(ns);
- }
-};
+#include "mongo/db/namespace_string-inl.h"
-struct NamespaceDBEquals {
- bool operator()(const std::string& a, const std::string& b) const {
- return nsDBEquals(a, b);
+MONGO_HASH_NAMESPACE_START
+template <>
+struct hash<mongo::NamespaceString> {
+ size_t operator()(const mongo::NamespaceString& nss) const {
+ mongo::NamespaceString::Hasher hasher;
+ return hasher(nss);
}
};
-
-} // namespace mongo
-
-#include "mongo/db/namespace_string-inl.h"
+MONGO_HASH_NAMESPACE_END