diff options
author | matt dannenberg <matt.dannenberg@10gen.com> | 2015-04-24 10:49:59 -0400 |
---|---|---|
committer | matt dannenberg <matt.dannenberg@10gen.com> | 2015-05-04 12:35:50 -0400 |
commit | 8a8ee2579878473e18e6d311bcb46dc90936328d (patch) | |
tree | 585957cb893c6b556f8ad903da4bbdfb8cf3134f /src/mongo/db/repl/last_vote.h | |
parent | b43f9663dd08d3f585a9ae9aa67476b5e1a9d07c (diff) | |
download | mongo-8a8ee2579878473e18e6d311bcb46dc90936328d.tar.gz |
SERVER-18253 create VoteRequester Scatter-Gather Algorithm to conduct new style elections
Diffstat (limited to 'src/mongo/db/repl/last_vote.h')
-rw-r--r-- | src/mongo/db/repl/last_vote.h | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/mongo/db/repl/last_vote.h b/src/mongo/db/repl/last_vote.h new file mode 100644 index 00000000000..b2314823f00 --- /dev/null +++ b/src/mongo/db/repl/last_vote.h @@ -0,0 +1,56 @@ +/** + * Copyright (C) 2015 MongoDB Inc. + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License, version 3, + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see <http://www.gnu.org/licenses/>. + * + * As a special exception, the copyright holders give permission to link the + * code of portions of this program with the OpenSSL library under certain + * conditions as described in each individual source file and distribute + * linked combinations including the program with the OpenSSL library. You + * must comply with the GNU Affero General Public License in all respects for + * all of the code used other than as permitted herein. If you modify file(s) + * with this exception, you may extend this exception to your version of the + * file(s), but you are not obligated to do so. If you do not wish to do so, + * delete this exception statement from your version. If you delete this + * exception statement from all source files in the program, then also delete + * it in the license file. + */ + +#pragma once + +namespace mongo { + + class BSONObj; + class BSONObjBuilder; + class Status; + +namespace repl { + + class LastVote { + public: + Status initialize(const BSONObj& argsObj); + + long long getTerm() const; + long long getCandidateId() const; + + void setTerm(long long term); + void setCandidateId(long long candidateId); + BSONObj toBSON() const; + + private: + long long _candidateId = -1; + long long _term = -1; + }; + +} // namespace repl +} // namespace mongo |