Package io.permazen.kv.raft.msg
Class RequestVote
java.lang.Object
io.permazen.kv.raft.msg.Message
io.permazen.kv.raft.msg.RequestVote
Send from candidates to other nodes to request a vote during an election.
-
Constructor Summary
ConstructorDescriptionRequestVote
(int clusterId, String senderId, String recipientId, long term, long lastLogTerm, long lastLogIndex) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected int
calculateSize
(int version) Calculate the number of bytes required bywriteTo()
.long
long
toString()
void
visit
(MessageSwitch handler) Apply the visitor pattern based on this instance's type.void
writeTo
(ByteBuffer dest, int version) Serialize this instance into the given buffer.Methods inherited from class io.permazen.kv.raft.msg.Message
calculateSize, calculateSize, calculateSize, decode, decodeProtocolVersion, encode, getBoolean, getByteBuffer, getClusterId, getCurrentProtocolVersion, getRecipientId, getSenderId, getString, getTerm, getTimestamp, isLeaderMessage, putBoolean, putByteBuffer, putString, putTimestamp
-
Constructor Details
-
RequestVote
public RequestVote(int clusterId, String senderId, String recipientId, long term, long lastLogTerm, long lastLogIndex) Constructor.- Parameters:
clusterId
- cluster IDsenderId
- identity of senderrecipientId
- identity of recipientterm
- sender's current termlastLogTerm
- term of the sender's last log entrylastLogIndex
- index of the sender's last log entry
-
-
Method Details
-
getLastLogTerm
public long getLastLogTerm() -
getLastLogIndex
public long getLastLogIndex() -
visit
Description copied from class:Message
Apply the visitor pattern based on this instance's type. -
writeTo
Description copied from class:Message
Serialize this instance into the given buffer. -
calculateSize
protected int calculateSize(int version) Description copied from class:Message
Calculate the number of bytes required bywriteTo()
.- Overrides:
calculateSize
in classMessage
- Parameters:
version
- protocol encoding version- Returns:
- an upper bound on the number of encoded bytes
-
toString
-