summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDwight <dmerriman@gmail.com>2009-02-11 11:36:51 -0500
committerDwight <dmerriman@gmail.com>2009-02-11 11:36:51 -0500
commit8a569e8bc07dbb103e2b061fff948c85d73559ed (patch)
tree8e9ae9be9d0d4c5d4ab99bd82f5340b853c6a391
parentd063654ff5757f1dbe2c315e0f14c6a54b4130a6 (diff)
downloadmongo-8a569e8bc07dbb103e2b061fff948c85d73559ed.tar.gz
finish the Repl client connection in the c++ driver.
-rw-r--r--client/dbclient.h30
1 files changed, 17 insertions, 13 deletions
diff --git a/client/dbclient.h b/client/dbclient.h
index 572df9209f7..48064e7833c 100644
--- a/client/dbclient.h
+++ b/client/dbclient.h
@@ -642,9 +642,10 @@ namespace mongo {
DBClientConnection& checkMaster();
public:
+ /** Call connect() after constructing. autoReconnect is always on for DBClientPaired connections. */
DBClientPaired();
- /* Returns false is neither member of the pair were reachable, or neither is
+ /** Returns false is neither member of the pair were reachable, or neither is
master, although,
when false returned, you can still try to use this connection object, it will
try reconnects.
@@ -660,46 +661,49 @@ namespace mongo {
return false;
}
+ /** Authorize. Authorizes both sides of the pair as needed.
+ */
bool auth(const char *dbname, const char *username, const char *pwd, string& errmsg);
- /* throws userassertion "no master found" */
+ /** throws userassertion "no master found" */
virtual
auto_ptr<DBClientCursor> query(const char *ns, Query query, int nToReturn = 0, int nToSkip = 0,
BSONObj *fieldsToReturn = 0, int queryOptions = 0);
- /* throws userassertion "no master found" */
+ /** throws userassertion "no master found" */
virtual
BSONObj findOne(const char *ns, Query query, BSONObj *fieldsToReturn = 0, int queryOptions = 0);
- // Not yet implemented
+ /** insert */
virtual void insert( const char * ns , BSONObj obj ) {
- assert( false );
+ checkMaster().insert(ns, obj);
}
- // Not yet implemented
+ /** insert multiple objects. Note that single object insert is asynchronous, so this version
+ is only nominally faster and not worth a special effort to try to use. */
virtual void insert( const char * ns, const vector< BSONObj >& v ) {
- assert( false );
+ checkMaster().insert(ns, v);
}
- // Not yet implemented
+ /** remove */
virtual void remove( const char * ns , Query obj , bool justOne = 0 ) {
- assert( false );
+ checkMaster().remove(ns, obj, justOne);
}
- // Not yet implemented
+ /** update */
virtual void update( const char * ns , Query query , BSONObj obj , bool upsert = 0 ) {
- assert( false );
+ return checkMaster().update(ns, query, obj, upsert);
}
string toString();
- /* notification that we got a "not master" error.
+ /* this is the callback from our underlying connections to notify us that we got a "not master" error.
*/
void isntMaster() {
master = ( ( master == Left ) ? NotSetR : NotSetL );
}
- /* TODO */
+ /* TODO - not yet implemented. mongos may need these. */
virtual bool call( Message &toSend, Message &response, bool assertOk=true ) { assert(false); return false; }
virtual void say( Message &toSend ) { assert(false); }
virtual void sayPiggyBack( Message &toSend ) { assert(false); }