diff options
author | Eliot Horowitz <eliot@10gen.com> | 2009-08-12 16:54:57 -0400 |
---|---|---|
committer | Eliot Horowitz <eliot@10gen.com> | 2009-08-12 16:54:57 -0400 |
commit | 0cfa107650fdc0f57b0823feb04ea7e1d705e102 (patch) | |
tree | a2c564225a78c1a56622d6e6ba5fda337f435847 | |
parent | 016d49ffd22aadaae8da90af542127b2442d1296 (diff) | |
download | mongo-0cfa107650fdc0f57b0823feb04ea7e1d705e102.tar.gz |
DBCclientPaired::slaveConn - for getting the slave side of a paired connection
-rw-r--r-- | client/dbclient.cpp | 5 | ||||
-rw-r--r-- | client/dbclient.h | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/client/dbclient.cpp b/client/dbclient.cpp index 6f10b8338c9..2ecfcc750f8 100644 --- a/client/dbclient.cpp +++ b/client/dbclient.cpp @@ -817,6 +817,11 @@ namespace mongo { return master == Left ? left : right; } + DBClientConnection& DBClientPaired::slaveConn(){ + DBClientConnection& m = checkMaster(); + return master == Left ? right : left; + } + bool DBClientPaired::connect(const string &serverHostname1, const string &serverHostname2) { string errmsg; bool l = left.connect(serverHostname1, errmsg); diff --git a/client/dbclient.h b/client/dbclient.h index 8f520ee8f2d..9a65f643e5e 100644 --- a/client/dbclient.h +++ b/client/dbclient.h @@ -789,11 +789,13 @@ namespace mongo { void isntMaster() { master = ( ( master == Left ) ? NotSetR : NotSetL ); } - + string getServerAddress() const { return left.getServerAddress() + "," + right.getServerAddress(); } + DBClientConnection& slaveConn(); + /* 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); } |