diff options
Diffstat (limited to 'src/mongo/db/repl/repl_set_request_votes_args.h')
-rw-r--r-- | src/mongo/db/repl/repl_set_request_votes_args.h | 106 |
1 files changed, 57 insertions, 49 deletions
diff --git a/src/mongo/db/repl/repl_set_request_votes_args.h b/src/mongo/db/repl/repl_set_request_votes_args.h index a0f2dc2157b..00ba4d06c1c 100644 --- a/src/mongo/db/repl/repl_set_request_votes_args.h +++ b/src/mongo/db/repl/repl_set_request_votes_args.h @@ -34,55 +34,63 @@ namespace mongo { - class BSONObj; +class BSONObj; namespace repl { - class ReplSetRequestVotesArgs { - public: - Status initialize(const BSONObj& argsObj); - - const std::string& getSetName() const; - long long getTerm() const; - long long getCandidateId() const; - long long getConfigVersion() const; - OpTime getLastCommittedOp() const; - bool isADryRun() const; - - void addToBSON(BSONObjBuilder* builder) const; - - private: - std::string _setName; // Name of the replset - long long _term = -1; // Current known term of the command issuer - long long _candidateId = -1; // replSet id of the member who sent the replSetRequestVotesCmd - long long _cfgver = -1; // replSet config version known to the command issuer - OpTime _lastCommittedOp; // The last known committed op of the command issuer - bool _dryRun = false; // Indicates this is a pre-election check when true - }; - - class ReplSetRequestVotesResponse { - public: - Status initialize(const BSONObj& argsObj); - - void setOk(bool ok) { _ok = ok; } - void setVoteGranted(bool voteGranted) { _voteGranted = voteGranted; } - void setTerm(long long term) { _term = term; } - void setReason(const std::string& reason) { _reason = reason; } - - bool getOk() const; - long long getTerm() const; - bool getVoteGranted() const; - const std::string& getReason() const; - - void addToBSON(BSONObjBuilder* builder) const; - BSONObj toBSON() const; - - private: - bool _ok = false; - long long _term = -1; - bool _voteGranted = false; - std::string _reason; - }; - -} // namespace repl -} // namespace mongo +class ReplSetRequestVotesArgs { +public: + Status initialize(const BSONObj& argsObj); + + const std::string& getSetName() const; + long long getTerm() const; + long long getCandidateId() const; + long long getConfigVersion() const; + OpTime getLastCommittedOp() const; + bool isADryRun() const; + + void addToBSON(BSONObjBuilder* builder) const; + +private: + std::string _setName; // Name of the replset + long long _term = -1; // Current known term of the command issuer + long long _candidateId = -1; // replSet id of the member who sent the replSetRequestVotesCmd + long long _cfgver = -1; // replSet config version known to the command issuer + OpTime _lastCommittedOp; // The last known committed op of the command issuer + bool _dryRun = false; // Indicates this is a pre-election check when true +}; + +class ReplSetRequestVotesResponse { +public: + Status initialize(const BSONObj& argsObj); + + void setOk(bool ok) { + _ok = ok; + } + void setVoteGranted(bool voteGranted) { + _voteGranted = voteGranted; + } + void setTerm(long long term) { + _term = term; + } + void setReason(const std::string& reason) { + _reason = reason; + } + + bool getOk() const; + long long getTerm() const; + bool getVoteGranted() const; + const std::string& getReason() const; + + void addToBSON(BSONObjBuilder* builder) const; + BSONObj toBSON() const; + +private: + bool _ok = false; + long long _term = -1; + bool _voteGranted = false; + std::string _reason; +}; + +} // namespace repl +} // namespace mongo |