diff --git a/client/dbclient.h b/client/dbclient.h index 35cd462148f..a5b2374fc14 100644 --- a/client/dbclient.h +++ b/client/dbclient.h @@ -547,6 +547,8 @@ namespace mongo { clears the index cache, so the subsequent call to ensureIndex for any index will go to the server */ virtual void resetIndexCache(); + + virtual string getServerAddress() const = 0; private: set _seenIndexes; @@ -639,6 +641,10 @@ namespace mongo { string toString() { return serverAddress; } + + string getServerAddress() const { + return serverAddress; + } protected: virtual bool call( Message &toSend, Message &response, bool assertOk = true ); @@ -726,6 +732,10 @@ namespace mongo { master = ( ( master == Left ) ? NotSetR : NotSetL ); } + string getServerAddress() const { + return left.getServerAddress() + "," + right.getServerAddress(); + } + /* 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); } diff --git a/db/instance.h b/db/instance.h index 925cdb49ac3..4b45df78e33 100644 --- a/db/instance.h +++ b/db/instance.h @@ -99,11 +99,14 @@ namespace mongo { // --- local client --- - + class DBDirectClient : public DBClientBase { virtual string toString() { return "DBDirectClient"; } + virtual string getServerAddress() const{ + return "localhost"; // TODO: should this have the port? + } virtual bool call( Message &toSend, Message &response, bool assertOk=true ); virtual void say( Message &toSend ); virtual void sayPiggyBack( Message &toSend ) {