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:
parent
c585ac8b40
commit
e91ed0e854
@ -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); }
|
||||
|
@ -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 ) {
|
||||
|
Loading…
Reference in New Issue
Block a user