diff options
Diffstat (limited to 'src/mongo/client/connpool.h')
-rw-r--r-- | src/mongo/client/connpool.h | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/mongo/client/connpool.h b/src/mongo/client/connpool.h index 09d5fb78b52..e7213abaa48 100644 --- a/src/mongo/client/connpool.h +++ b/src/mongo/client/connpool.h @@ -99,7 +99,7 @@ namespace mongo { void flush(); - void getStaleConnections( vector<DBClientBase*>& stale ); + void getStaleConnections( std::vector<DBClientBase*>& stale ); /** * Sets the lower bound for creation times that can be considered as @@ -171,7 +171,7 @@ namespace mongo { ~DBConnectionPool(); /** right now just controls some asserts. defaults to "dbconnectionpool" */ - void setName( const string& name ) { _name = name; } + void setName( const std::string& name ) { _name = name; } /** * Returns the maximum number of connections pooled per-host @@ -195,10 +195,10 @@ namespace mongo { void flush(); - DBClientBase *get(const string& host, double socketTimeout = 0); + DBClientBase *get(const std::string& host, double socketTimeout = 0); DBClientBase *get(const ConnectionString& host, double socketTimeout = 0); - void release(const string& host, DBClientBase *c); + void release(const std::string& host, DBClientBase *c); void addHook( DBConnectionHook * hook ); // we take ownership void appendInfo( BSONObjBuilder& b ); @@ -217,29 +217,29 @@ namespace mongo { * @return true if the connection is not bad, meaning, it is good to keep it for * future use. */ - bool isConnectionGood(const string& host, DBClientBase* conn); + bool isConnectionGood(const std::string& host, DBClientBase* conn); // Removes and deletes all connections from the pool for the host (regardless of timeout) - void removeHost( const string& host ); + void removeHost( const std::string& host ); /** compares server namees, but is smart about replica set names */ struct serverNameCompare { - bool operator()( const string& a , const string& b ) const; + bool operator()( const std::string& a , const std::string& b ) const; }; - virtual string taskName() const { return "DBConnectionPool-cleaner"; } + virtual std::string taskName() const { return "DBConnectionPool-cleaner"; } virtual void taskDoWork(); private: DBConnectionPool( DBConnectionPool& p ); - DBClientBase* _get( const string& ident , double socketTimeout ); + DBClientBase* _get( const std::string& ident , double socketTimeout ); - DBClientBase* _finishCreate( const string& ident , double socketTimeout, DBClientBase* conn ); + DBClientBase* _finishCreate( const std::string& ident , double socketTimeout, DBClientBase* conn ); struct PoolKey { PoolKey( const std::string& i , double t ) : ident( i ) , timeout( t ) {} - string ident; + std::string ident; double timeout; }; @@ -247,10 +247,10 @@ namespace mongo { bool operator()( const PoolKey& a , const PoolKey& b ) const; }; - typedef map<PoolKey,PoolForHost,poolKeyCompare> PoolMap; // servername -> pool + typedef std::map<PoolKey,PoolForHost,poolKeyCompare> PoolMap; // servername -> pool mongo::mutex _mutex; - string _name; + std::string _name; // The maximum number of connections we'll save in the pool per-host // PoolForHost::kPoolSizeUnlimited is a sentinel value meaning "no limit" @@ -261,7 +261,7 @@ namespace mongo { // pointers owned by me, right now they leak on shutdown // _hooks itself also leaks because it creates a shutdown race condition - list<DBConnectionHook*> * _hooks; + std::list<DBConnectionHook*> * _hooks; }; @@ -274,7 +274,7 @@ namespace mongo { virtual DBClientBase* get() = 0; virtual void done() = 0; - virtual string getHost() const = 0; + virtual std::string getHost() const = 0; /** * @return true iff this has a connection to the db @@ -299,7 +299,7 @@ namespace mongo { /** the main constructor you want to use throws UserException if can't connect */ - explicit ScopedDbConnection(const string& host, double socketTimeout = 0) : _host(host), _conn( pool.get(host, socketTimeout) ), _socketTimeout( socketTimeout ) { + explicit ScopedDbConnection(const std::string& host, double socketTimeout = 0) : _host(host), _conn( pool.get(host, socketTimeout) ), _socketTimeout( socketTimeout ) { _setSocketTimeout(); } @@ -310,7 +310,7 @@ namespace mongo { ScopedDbConnection() : _host( "" ) , _conn(0), _socketTimeout( 0 ) {} /* @param conn - bind to an existing connection */ - ScopedDbConnection(const string& host, DBClientBase* conn, double socketTimeout = 0 ) : _host( host ) , _conn( conn ), _socketTimeout( socketTimeout ) { + ScopedDbConnection(const std::string& host, DBClientBase* conn, double socketTimeout = 0 ) : _host( host ) , _conn( conn ), _socketTimeout( socketTimeout ) { _setSocketTimeout(); } @@ -338,7 +338,7 @@ namespace mongo { bool ok() const { return _conn != NULL; } - string getHost() const { return _host; } + std::string getHost() const { return _host; } /** Force closure of the connection. You should call this if you leave it in a bad state. Destructor will do this too, but it is verbose. @@ -371,7 +371,7 @@ namespace mongo { void _setSocketTimeout(); - const string _host; + const std::string _host; DBClientBase *_conn; const double _socketTimeout; |