Package io.atomix.raft.protocol
Class VoteRequest
java.lang.Object
io.atomix.raft.protocol.AbstractRaftRequest
io.atomix.raft.protocol.VoteRequest
- All Implemented Interfaces:
RaftMessage,RaftRequest
Server vote request.
Vote requests are sent by candidate servers during an election to determine whether they should become the leader for a cluster. Vote requests contain the necessary information for followers to determine whether a candidate should receive their vote based on log and other information.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionVoteRequest(long term, String candidate, long lastLogIndex, long lastLogTerm) -
Method Summary
Modifier and TypeMethodDescriptionstatic VoteRequest.Builderbuilder()Returns a new vote request builder.Returns the candidate's address.booleanfrom()inthashCode()longReturns the candidate's last log index.longReturns the candidate's last log term.longterm()Returns the requesting node's current term.toString()
-
Constructor Details
-
VoteRequest
-
-
Method Details
-
builder
Returns a new vote request builder.- Returns:
- A new vote request builder.
-
term
public long term()Returns the requesting node's current term.- Returns:
- The requesting node's current term.
-
candidate
Returns the candidate's address.- Returns:
- The candidate's address.
-
lastLogIndex
public long lastLogIndex()Returns the candidate's last log index.- Returns:
- The candidate's last log index.
-
lastLogTerm
public long lastLogTerm()Returns the candidate's last log term.- Returns:
- The candidate's last log term.
-
hashCode
public int hashCode() -
equals
-
toString
-
from
-