0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

add DBClientBase::getServerAddress()

This commit is contained in:
Eliot Horowitz 2009-03-25 17:08:36 -04:00
parent c585ac8b40
commit e91ed0e854
2 changed files with 14 additions and 1 deletions

View File

@ -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); }

View File

@ -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 ) {