Commit b69be9ed authored by Georgios Bitzes's avatar Georgios Bitzes
Browse files

raft: re-add support for pre-vote in RaftTalker

parent f03b5eea
Pipeline #1561219 passed with stages
in 113 minutes and 41 seconds
......@@ -203,10 +203,16 @@ std::future<redisReplyPtr> RaftTalker::appendEntries(
return qcl->execute(payload);
}
std::future<redisReplyPtr> RaftTalker::requestVote(const RaftVoteRequest &req) {
std::future<redisReplyPtr> RaftTalker::requestVote(const RaftVoteRequest &req, bool preVote) {
RedisRequest payload;
payload.emplace_back("RAFT_REQUEST_VOTE");
if(preVote) {
payload.emplace_back("RAFT_REQUEST_PRE_VOTE");
}
else {
payload.emplace_back("RAFT_REQUEST_VOTE");
}
payload.emplace_back(std::to_string(req.term));
payload.emplace_back(req.candidate.toString());
payload.emplace_back(std::to_string(req.lastIndex));
......
......@@ -47,7 +47,7 @@ public:
RaftTerm prevTerm, LogIndex commit,
const std::vector<RaftSerializedEntry> &entries);
std::future<redisReplyPtr> requestVote(const RaftVoteRequest &req);
std::future<redisReplyPtr> requestVote(const RaftVoteRequest &req, bool preVote = false);
std::future<redisReplyPtr> fetch(LogIndex index);
std::future<redisReplyPtr> resilveringStart(const ResilveringEventID &id);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment