summaryrefslogtreecommitdiff
path: root/src/mongo/shell/shell_utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/shell/shell_utils.h')
-rw-r--r--src/mongo/shell/shell_utils.h106
1 files changed, 54 insertions, 52 deletions
diff --git a/src/mongo/shell/shell_utils.h b/src/mongo/shell/shell_utils.h
index ee773e9e029..b00b10f2d9c 100644
--- a/src/mongo/shell/shell_utils.h
+++ b/src/mongo/shell/shell_utils.h
@@ -35,56 +35,58 @@
namespace mongo {
- class Scope;
- class DBClientWithCommands;
-
- namespace shell_utils {
-
- extern std::string _dbConnect;
- extern std::string _dbAuth;
- extern bool _nokillop;
-
- void RecordMyLocation( const char *_argv0 );
- void installShellUtils( Scope& scope );
-
- void initScope( Scope &scope );
- void onConnect( DBClientWithCommands &c );
-
- const char* getUserDir();
-
- BSONElement singleArg(const BSONObj& args);
- extern const BSONObj undefinedReturn;
-
- /** Prompt for confirmation from cin. */
- class Prompter {
- public:
- Prompter( const std::string &prompt );
- /** @return prompted confirmation or cached confirmation. */
- bool confirm();
- private:
- const std::string _prompt;
- bool _confirmed;
- };
-
- /** Registry of server connections. */
- class ConnectionRegistry {
- public:
- ConnectionRegistry();
- void registerConnection( DBClientWithCommands &client );
- void killOperationsOnAllConnections( bool withPrompt ) const;
- private:
- std::map<std::string,std::set<std::string> > _connectionUris;
- mutable stdx::mutex _mutex;
- };
-
- extern ConnectionRegistry connectionRegistry;
-
- // This mutex helps the shell serialize output on exit, to avoid deadlocks at shutdown. So
- // it also protects the global dbexitCalled.
- extern stdx::mutex &mongoProgramOutputMutex;
-
- // Helper to tell if a file exists cross platform
- // TODO: Remove this when we have a cross platform file utility library
- bool fileExists(const std::string& file);
- }
+class Scope;
+class DBClientWithCommands;
+
+namespace shell_utils {
+
+extern std::string _dbConnect;
+extern std::string _dbAuth;
+extern bool _nokillop;
+
+void RecordMyLocation(const char* _argv0);
+void installShellUtils(Scope& scope);
+
+void initScope(Scope& scope);
+void onConnect(DBClientWithCommands& c);
+
+const char* getUserDir();
+
+BSONElement singleArg(const BSONObj& args);
+extern const BSONObj undefinedReturn;
+
+/** Prompt for confirmation from cin. */
+class Prompter {
+public:
+ Prompter(const std::string& prompt);
+ /** @return prompted confirmation or cached confirmation. */
+ bool confirm();
+
+private:
+ const std::string _prompt;
+ bool _confirmed;
+};
+
+/** Registry of server connections. */
+class ConnectionRegistry {
+public:
+ ConnectionRegistry();
+ void registerConnection(DBClientWithCommands& client);
+ void killOperationsOnAllConnections(bool withPrompt) const;
+
+private:
+ std::map<std::string, std::set<std::string>> _connectionUris;
+ mutable stdx::mutex _mutex;
+};
+
+extern ConnectionRegistry connectionRegistry;
+
+// This mutex helps the shell serialize output on exit, to avoid deadlocks at shutdown. So
+// it also protects the global dbexitCalled.
+extern stdx::mutex& mongoProgramOutputMutex;
+
+// Helper to tell if a file exists cross platform
+// TODO: Remove this when we have a cross platform file utility library
+bool fileExists(const std::string& file);
+}
}