raft4s
raft4s copied to clipboard
Result types mismatch in the Follower NodeState
Hi! I'm not very familiar with Scala and I find these lines weird in FollowerNode.scala
:
if (msg.term < currentTerm) {
(this, (VoteResponse(node, msg.term, false)))
} else if (votedFor.isEmpty || votedFor.contains(msg.nodeId)) {
if (msg.lastLogIndex >= logState.lastLogIndex && msg.lastLogTerm >= logState.lastLogTerm.getOrElse(0L)) {
(VoteResponse(node, msg.term, true), List(StoreState))
} else {
(this, (VoteResponse(node, msg.term, false)))
}
}
As the the method is declared to return type (NodeState, (VoteResponse, List[Action]))
. @alirezameskin