diff options
author | Charlie Swanson <charlie.swanson@mongodb.com> | 2016-11-15 16:17:19 -0500 |
---|---|---|
committer | Charlie Swanson <charlie.swanson@mongodb.com> | 2017-03-15 11:03:44 -0400 |
commit | 584ca76de9ee66b3e11987e640f5317ae40975e4 (patch) | |
tree | db52f1717155c295437f1b4fa41a5db295183669 /src/mongo/db/namespace_string.h | |
parent | f05b9437fbdc53deecf55ed3c20e36af3d733953 (diff) | |
download | mongo-584ca76de9ee66b3e11987e640f5317ae40975e4.tar.gz |
SERVER-22541 Manage aggregation cursors on global cursor manager.
Moves registration of aggregation cursors to the global cursor manager.
This simplifies the logic for acquiring locks and resolving view
namespaces within the getMore and killCursors commands.
Diffstat (limited to 'src/mongo/db/namespace_string.h')
-rw-r--r-- | src/mongo/db/namespace_string.h | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h index c623dbbac90..58f26d76b2c 100644 --- a/src/mongo/db/namespace_string.h +++ b/src/mongo/db/namespace_string.h @@ -31,6 +31,7 @@ #pragma once #include <algorithm> +#include <boost/optional.hpp> #include <iosfwd> #include <string> @@ -93,13 +94,13 @@ public: NamespaceString(StringData dbName, StringData collectionName); /** - * Contructs a NamespaceString representing a listCollections namespace. The format for this + * Constructs a NamespaceString representing a listCollections namespace. The format for this * namespace is "<dbName>.$cmd.listCollections". */ static NamespaceString makeListCollectionsNSS(StringData dbName); /** - * Contructs a NamespaceString representing a listIndexes namespace. The format for this + * Constructs a NamespaceString representing a listIndexes namespace. The format for this * namespace is "<dbName>.$cmd.listIndexes.<collectionName>". */ static NamespaceString makeListIndexesNSS(StringData dbName, StringData collectionName); @@ -202,10 +203,25 @@ public: bool isVirtualized() const { return virtualized(_ns); } + + /** + * Returns true if cursors for this namespace are registered with the global cursor manager. + */ + bool isGloballyManagedNamespace() const { + return coll().startsWith("$cmd."_sd); + } + bool isListCollectionsCursorNS() const; bool isListIndexesCursorNS() const; /** + * Given a NamespaceString for which isGloballyManagedNamespace() returns true, returns the + * namespace the command targets, or boost::none for commands like 'listCollections' which + * do not target a collection. + */ + boost::optional<NamespaceString> getTargetNSForGloballyManagedNamespace() const; + + /** * Given a NamespaceString for which isListIndexesCursorNS() returns true, returns the * NamespaceString for the collection that the "listIndexes" targets. */ |