#include <connpool.h>
Classes | |
struct | serverNameCompare |
Public Member Functions | |
void | addHook (DBConnectionHook *hook) |
void | appendInfo (BSONObjBuilder &b) |
DBConnectionPool () | |
void | flush () |
DBClientBase * | get (const ConnectionString &host) |
DBClientBase * | get (const string &host) |
void | onCreate (DBClientBase *conn) |
void | onHandedOut (DBClientBase *conn) |
void | release (const string &host, DBClientBase *c) |
void | setName (const string &name) |
~DBConnectionPool () | |
Private Types | |
typedef map< string, PoolForHost, serverNameCompare > | PoolMap |
Private Member Functions | |
DBClientBase * | _finishCreate (const string &ident, DBClientBase *conn) |
DBClientBase * | _get (const string &ident) |
Private Attributes | |
list< DBConnectionHook * > | _hooks |
mongo::mutex | _mutex |
string | _name |
PoolMap | _pools |
Database connection pool.
Generally, use ScopedDbConnection and do not call these directly.
This class, so far, is suitable for use with unauthenticated connections. Support for authenticated connections requires some adjustements: please request...
Usage:
{ ScopedDbConnection c("myserver"); c.conn()... }
Definition at line 102 of file connpool.h.
typedef map<string,PoolForHost,serverNameCompare> mongo::DBConnectionPool::PoolMap [private] |
Definition at line 114 of file connpool.h.
mongo::DBConnectionPool::DBConnectionPool | ( | ) | [inline] |
Definition at line 124 of file connpool.h.
mongo::DBConnectionPool::~DBConnectionPool | ( | ) |
DBClientBase* mongo::DBConnectionPool::_finishCreate | ( | const string & | ident, | |
DBClientBase * | conn | |||
) | [private] |
DBClientBase* mongo::DBConnectionPool::_get | ( | const string & | ident | ) | [private] |
void mongo::DBConnectionPool::addHook | ( | DBConnectionHook * | hook | ) |
void mongo::DBConnectionPool::appendInfo | ( | BSONObjBuilder & | b | ) |
void mongo::DBConnectionPool::flush | ( | ) |
DBClientBase* mongo::DBConnectionPool::get | ( | const ConnectionString & | host | ) |
DBClientBase* mongo::DBConnectionPool::get | ( | const string & | host | ) |
void mongo::DBConnectionPool::onCreate | ( | DBClientBase * | conn | ) |
void mongo::DBConnectionPool::onHandedOut | ( | DBClientBase * | conn | ) |
void mongo::DBConnectionPool::release | ( | const string & | host, | |
DBClientBase * | c | |||
) | [inline] |
Definition at line 138 of file connpool.h.
void mongo::DBConnectionPool::setName | ( | const string & | name | ) | [inline] |
right now just controls some asserts. defaults to "dbconnectionpool"
Definition at line 128 of file connpool.h.
list<DBConnectionHook*> mongo::DBConnectionPool::_hooks [private] |
Definition at line 116 of file connpool.h.
mongo::mutex mongo::DBConnectionPool::_mutex [private] |
Definition at line 113 of file connpool.h.
string mongo::DBConnectionPool::_name [private] |
Definition at line 117 of file connpool.h.
PoolMap mongo::DBConnectionPool::_pools [private] |
Definition at line 115 of file connpool.h.