Election
franktank opened this issue · comments
- Request Vote RPC
- Request / Response
- Read / look at pseudocode
- Conditions to step down / grant vote
- Track when each variable is supposed to be modified
- Follower, Candidate, Leader
- In design process, think about how to separate each role
- Make sure role is candidate before granting to leader
- How to cancel an election? -> use role idea? -> read more into it
For example, if you have already voted in the current term, and an incoming RequestVote RPC has a higher term that you, you should first step down and adopt their term (thereby resetting votedFor), and then handle the RPC, which will result in you granting the vote!