summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEliot Horowitz <eliot@10gen.com>2009-03-25 17:08:36 -0400
committerEliot Horowitz <eliot@10gen.com>2009-03-25 17:08:36 -0400
commite91ed0e8548a6444da914794d26574f1f6620b7d (patch)
tree598b50ba7676b9aaf9b9d0980cd83ee4430b35ae
parentc585ac8b400e6e6e376fe5a73251d2807f3dd91a (diff)
downloadmongo-e91ed0e8548a6444da914794d26574f1f6620b7d.tar.gz
add DBClientBase::getServerAddress()
-rw-r--r--client/dbclient.h10
-rw-r--r--db/instance.h5
2 files changed, 14 insertions, 1 deletions
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<string> _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 ) {