mongo::Client::Context Class Reference

#include <client.h>

List of all members.

Public Member Functions

void clear ()
 Context (string ns, Database *db, bool doauth=true)
 Context ()
 Context (const string &ns, string path=dbpath, mongolock *lock=0, bool doauth=true)
Databasedb () const
bool equals (const string &ns, const string &path=dbpath) const
ClientgetClient () const
bool inDB (const string &db, const string &path=dbpath) const
bool justCreated () const
const char * ns () const
void relocked ()
void unlocked ()
 ~Context ()

Private Member Functions

void _auth (int lockState=dbMutex.getState())
void _finishInit (bool doauth=true)

Private Attributes

Client_client
Database_db
bool _justCreated
mongolock_lock
string _ns
Context_oldContext
string _path

Friends

class CurOp

Detailed Description

Definition at line 135 of file db/client.h.


Constructor & Destructor Documentation

mongo::Client::Context::Context ( const string &  ns,
string  path = dbpath,
mongolock lock = 0,
bool  doauth = true 
)

this is the main constructor use this unless there is a good reason not to

mongo::Client::Context::Context (  ) 
mongo::Client::Context::Context ( string  ns,
Database db,
bool  doauth = true 
)

if you are doing this after allowing a write there could be a race condition if someone closes that db. this checks that the DB is still valid

mongo::Client::Context::~Context (  ) 

Member Function Documentation

void mongo::Client::Context::_auth ( int  lockState = dbMutex.getState()  )  [private]
void mongo::Client::Context::_finishInit ( bool  doauth = true  )  [private]

at this point _client, _oldContext and _ns have to be set _db should not have been touched this will set _db and create if needed will also set _client->_context to this

void mongo::Client::Context::clear (  )  [inline]

Definition at line 168 of file db/client.h.

Database* mongo::Client::Context::db (  )  const [inline]

Definition at line 155 of file db/client.h.

bool mongo::Client::Context::equals ( const string &  ns,
const string &  path = dbpath 
) const [inline]

Definition at line 161 of file db/client.h.

Client* mongo::Client::Context::getClient (  )  const [inline]

Definition at line 154 of file db/client.h.

bool mongo::Client::Context::inDB ( const string &  db,
const string &  path = dbpath 
) const
Returns:
true iff the current Context is using db/path
bool mongo::Client::Context::justCreated (  )  const [inline]
Returns:
if the db was created by this Context

Definition at line 159 of file db/client.h.

const char* mongo::Client::Context::ns (  )  const [inline]

Definition at line 156 of file db/client.h.

void mongo::Client::Context::relocked (  )  [inline]

call after going back into the lock, will re-establish non-thread safe stuff

Definition at line 178 of file db/client.h.

void mongo::Client::Context::unlocked (  )  [inline]

call before unlocking, so clear any non-thread safe state

Definition at line 173 of file db/client.h.


Friends And Related Function Documentation

friend class CurOp [friend]

Definition at line 180 of file db/client.h.


Member Data Documentation

Definition at line 193 of file db/client.h.

Definition at line 201 of file db/client.h.

Definition at line 198 of file db/client.h.

Definition at line 197 of file db/client.h.

string mongo::Client::Context::_ns [private]

Definition at line 200 of file db/client.h.

Definition at line 194 of file db/client.h.

Definition at line 196 of file db/client.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:54 2013