diff options
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. */ |