summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/last_vote.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/repl/last_vote.cpp')
-rw-r--r--src/mongo/db/repl/last_vote.cpp77
1 files changed, 37 insertions, 40 deletions
diff --git a/src/mongo/db/repl/last_vote.cpp b/src/mongo/db/repl/last_vote.cpp
index e7a1b178bf4..94e88231bac 100644
--- a/src/mongo/db/repl/last_vote.cpp
+++ b/src/mongo/db/repl/last_vote.cpp
@@ -36,57 +36,54 @@ namespace mongo {
namespace repl {
namespace {
- const std::string kCandidateIdFieldName = "candidateId";
- const std::string kTermFieldName = "term";
+const std::string kCandidateIdFieldName = "candidateId";
+const std::string kTermFieldName = "term";
- const std::string kLegalFieldNames[] = {
- kCandidateIdFieldName,
- kTermFieldName,
- };
+const std::string kLegalFieldNames[] = {
+ kCandidateIdFieldName, kTermFieldName,
+};
} // namespace
- Status LastVote::initialize(const BSONObj& argsObj) {
- Status status = bsonCheckOnlyHasFields("VotedFar",
- argsObj,
- kLegalFieldNames);
- if (!status.isOK())
- return status;
+Status LastVote::initialize(const BSONObj& argsObj) {
+ Status status = bsonCheckOnlyHasFields("VotedFar", argsObj, kLegalFieldNames);
+ if (!status.isOK())
+ return status;
- status = bsonExtractIntegerField(argsObj, kTermFieldName, &_term);
- if (!status.isOK())
- return status;
+ status = bsonExtractIntegerField(argsObj, kTermFieldName, &_term);
+ if (!status.isOK())
+ return status;
- status = bsonExtractIntegerField(argsObj, kCandidateIdFieldName, &_candidateId);
- if (!status.isOK())
- return status;
+ status = bsonExtractIntegerField(argsObj, kCandidateIdFieldName, &_candidateId);
+ if (!status.isOK())
+ return status;
- return Status::OK();
- }
+ return Status::OK();
+}
- void LastVote::setTerm(long long term) {
- _term = term;
- }
+void LastVote::setTerm(long long term) {
+ _term = term;
+}
- void LastVote::setCandidateId(long long candidateId) {
- _candidateId = candidateId;
- }
+void LastVote::setCandidateId(long long candidateId) {
+ _candidateId = candidateId;
+}
- long long LastVote::getTerm() const {
- return _term;
- }
+long long LastVote::getTerm() const {
+ return _term;
+}
- long long LastVote::getCandidateId() const {
- return _candidateId;
- }
+long long LastVote::getCandidateId() const {
+ return _candidateId;
+}
- BSONObj LastVote::toBSON() const {
- BSONObjBuilder builder;
- builder.append(kTermFieldName, _term);
- builder.append(kCandidateIdFieldName, _candidateId);
- return builder.obj();
- }
+BSONObj LastVote::toBSON() const {
+ BSONObjBuilder builder;
+ builder.append(kTermFieldName, _term);
+ builder.append(kCandidateIdFieldName, _candidateId);
+ return builder.obj();
+}
-} // namespace repl
-} // namespace mongo
+} // namespace repl
+} // namespace mongo