summaryrefslogtreecommitdiff
path: root/src/mongo/shell/shell_utils.h
diff options
context:
space:
mode:
authorAaron <aaron@10gen.com>2012-04-08 13:08:11 -0700
committerAaron <aaron@10gen.com>2012-04-10 20:21:51 -0700
commit2684b7b6dc10663b8908c08fa167c1d0d13126c8 (patch)
treef12ae338d6c3332fe7e87e714aa1414152e6d000 /src/mongo/shell/shell_utils.h
parent473a59f7d3719e1eb9b5fd91043742f7be223b93 (diff)
downloadmongo-2684b7b6dc10663b8908c08fa167c1d0d13126c8.tar.gz
Refactor _allMyUris to ConnectionRegistry and lock the registry when killing running operations.
Diffstat (limited to 'src/mongo/shell/shell_utils.h')
-rw-r--r--src/mongo/shell/shell_utils.h25
1 files changed, 24 insertions, 1 deletions
diff --git a/src/mongo/shell/shell_utils.h b/src/mongo/shell/shell_utils.h
index c789076ac28..a9b343baecb 100644
--- a/src/mongo/shell/shell_utils.h
+++ b/src/mongo/shell/shell_utils.h
@@ -29,7 +29,6 @@ namespace mongo {
extern std::string _dbConnect;
extern std::string _dbAuth;
- extern map< string, set<string> > _allMyUris;
extern bool _nokillop;
void RecordMyLocation( const char *_argv0 );
@@ -42,5 +41,29 @@ namespace mongo {
BSONElement oneArg(const BSONObj& args);
extern const BSONObj undefined_;
+
+ /** Prompt for confirmation from cin. */
+ class Prompter {
+ public:
+ Prompter( const string &prompt );
+ /** @return prompted confirmation or cached confirmation. */
+ bool confirm();
+ private:
+ const string _prompt;
+ bool _confirmed;
+ };
+
+ /** Registry of server connections. */
+ class ConnectionRegistry {
+ public:
+ ConnectionRegistry();
+ void registerConnection( DBClientWithCommands &client );
+ void killOperationsOnAllConnections( bool withPrompt ) const;
+ private:
+ map<string,set<string> > _connectionUris;
+ mutable mongo::mutex _mutex;
+ };
+
+ extern ConnectionRegistry connectionRegistry;
}
}