diff options
Diffstat (limited to 'db/repl/rs_config.h')
-rw-r--r-- | db/repl/rs_config.h | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/db/repl/rs_config.h b/db/repl/rs_config.h index 38df772..e39dad7 100644 --- a/db/repl/rs_config.h +++ b/db/repl/rs_config.h @@ -41,18 +41,27 @@ namespace mongo { bool ok() const { return _ok; } struct MemberCfg { - MemberCfg() : _id(-1), votes(1), priority(1.0), arbiterOnly(false) { } + MemberCfg() : _id(-1), votes(1), priority(1.0), arbiterOnly(false), slaveDelay(0), hidden(false) { } int _id; /* ordinal */ unsigned votes; /* how many votes this node gets. default 1. */ HostAndPort h; double priority; /* 0 means can never be primary */ bool arbiterOnly; + int slaveDelay; /* seconds. int rather than unsigned for convenient to/front bson conversion. */ + bool hidden; /* if set, don't advertise to drives in isMaster. for non-primaries (priority 0) */ + void check() const; /* check validity, assert if not. */ BSONObj asBson() const; bool potentiallyHot() const { return !arbiterOnly && priority > 0; } + bool operator==(const MemberCfg& r) const { + return _id==r._id && votes == r.votes && h == r.h && priority == r.priority && + arbiterOnly == r.arbiterOnly && slaveDelay == r.slaveDelay && hidden == r.hidden; + } + bool operator!=(const MemberCfg& r) const { return !(*this == r); } }; + vector<MemberCfg> members; string _id; int version; @@ -68,7 +77,7 @@ namespace mongo { string toString() const { return asBson().toString(); } /** validate the settings. does not call check() on each member, you have to do that separately. */ - void check() const; + void checkRsConfig() const; /** check if modification makes sense */ static bool legalChange(const ReplSetConfig& old, const ReplSetConfig& n, string& errmsg); |