mongo::ScopedDbConnection Class Reference

#include <connpool.h>

Inheritance diagram for mongo::ScopedDbConnection:
Inheritance graph
[legend]

List of all members.

Public Member Functions

DBClientBaseconn ()
void done ()
DBClientBaseget ()
string getHost () const
void kill ()
DBClientBaseoperator-> ()
 ScopedDbConnection (const Shard *shard)
 ScopedDbConnection (const Shard &shard)
 ScopedDbConnection (const ConnectionString &url)
 ScopedDbConnection (const string &host, DBClientBase *conn)
 ScopedDbConnection ()
 ScopedDbConnection (const string &host)
ScopedDbConnectionsteal ()
 ~ScopedDbConnection ()

Private Attributes

DBClientBase_conn
const string _host

Detailed Description

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.


Constructor & Destructor Documentation

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 (  ) 

Member Function Documentation

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 (  ) 

Member Data Documentation

Definition at line 245 of file connpool.h.

const string mongo::ScopedDbConnection::_host [private]

Definition at line 244 of file connpool.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines


mongodb
Author(s): Nate Koenig
autogenerated on Fri Jan 11 12:15:57 2013