#include <connpool.h>
Public Member Functions | |
DBClientBase & | conn () |
void | done () |
DBClientBase * | get () |
string | getHost () const |
void | kill () |
DBClientBase * | operator-> () |
ScopedDbConnection (const Shard *shard) | |
ScopedDbConnection (const Shard &shard) | |
ScopedDbConnection (const ConnectionString &url) | |
ScopedDbConnection (const string &host, DBClientBase *conn) | |
ScopedDbConnection () | |
ScopedDbConnection (const string &host) | |
ScopedDbConnection * | steal () |
~ScopedDbConnection () | |
Private Attributes | |
DBClientBase * | _conn |
const string | _host |
Use to get a connection from the pool. On exceptions things clean up nicely (i.e. the socket gets closed automatically when the scopeddbconnection goes out of scope).
Definition at line 173 of file connpool.h.
mongo::ScopedDbConnection::ScopedDbConnection | ( | const string & | host | ) | [inline, explicit] |
the main constructor you want to use throws UserException if can't connect
Definition at line 178 of file connpool.h.
mongo::ScopedDbConnection::ScopedDbConnection | ( | ) | [inline] |
Definition at line 180 of file connpool.h.
mongo::ScopedDbConnection::ScopedDbConnection | ( | const string & | host, | |
DBClientBase * | conn | |||
) | [inline] |
Definition at line 183 of file connpool.h.
mongo::ScopedDbConnection::ScopedDbConnection | ( | const ConnectionString & | url | ) | [inline, explicit] |
throws UserException if can't connect
Definition at line 186 of file connpool.h.
mongo::ScopedDbConnection::ScopedDbConnection | ( | const Shard & | shard | ) | [explicit] |
throws UserException if can't connect
mongo::ScopedDbConnection::ScopedDbConnection | ( | const Shard * | shard | ) | [explicit] |
mongo::ScopedDbConnection::~ScopedDbConnection | ( | ) |
DBClientBase& mongo::ScopedDbConnection::conn | ( | ) | [inline] |
get the associated connection object
Definition at line 201 of file connpool.h.
void mongo::ScopedDbConnection::done | ( | ) | [inline, virtual] |
Call this when you are done with the connection.
If you do not call done() before this object goes out of scope, we can't be sure we fully read all expected data of a reply on the socket. so we don't try to reuse the connection in that situation.
Implements mongo::AScopedConnection.
Definition at line 228 of file connpool.h.
DBClientBase* mongo::ScopedDbConnection::get | ( | ) | [inline, virtual] |
get the associated connection object
Implements mongo::AScopedConnection.
Definition at line 207 of file connpool.h.
string mongo::ScopedDbConnection::getHost | ( | ) | const [inline, virtual] |
Implements mongo::AScopedConnection.
Definition at line 212 of file connpool.h.
void mongo::ScopedDbConnection::kill | ( | ) | [inline] |
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.
Definition at line 217 of file connpool.h.
DBClientBase* mongo::ScopedDbConnection::operator-> | ( | ) | [inline] |
get the associated connection object
Definition at line 195 of file connpool.h.
ScopedDbConnection* mongo::ScopedDbConnection::steal | ( | ) |
DBClientBase* mongo::ScopedDbConnection::_conn [private] |
Definition at line 245 of file connpool.h.
const string mongo::ScopedDbConnection::_host [private] |
Definition at line 244 of file connpool.h.