Class RequestVote

java.lang.Object
io.permazen.kv.raft.msg.Message
io.permazen.kv.raft.msg.RequestVote

public class RequestVote extends Message
Send from candidates to other nodes to request a vote during an election.
  • Constructor Details

    • RequestVote

      public RequestVote(int clusterId, String senderId, String recipientId, long term, long lastLogTerm, long lastLogIndex)
      Constructor.
      Parameters:
      clusterId - cluster ID
      senderId - identity of sender
      recipientId - identity of recipient
      term - sender's current term
      lastLogTerm - term of the sender's last log entry
      lastLogIndex - index of the sender's last log entry
  • Method Details

    • getLastLogTerm

      public long getLastLogTerm()
    • getLastLogIndex

      public long getLastLogIndex()
    • visit

      public void visit(MessageSwitch handler)
      Description copied from class: Message
      Apply the visitor pattern based on this instance's type.
      Specified by:
      visit in class Message
      Parameters:
      handler - target for visit
    • writeTo

      public void writeTo(ByteBuffer dest, int version)
      Description copied from class: Message
      Serialize this instance into the given buffer.
      Overrides:
      writeTo in class Message
      Parameters:
      dest - destination for encoded data
      version - protocol encoding version number
    • calculateSize

      protected int calculateSize(int version)
      Description copied from class: Message
      Calculate an upper bound on the number of bytes required by writeTo().
      Overrides:
      calculateSize in class Message
      Parameters:
      version - protocol encoding version
      Returns:
      an upper bound on the number of encoded bytes
    • toString

      public String toString()
      Specified by:
      toString in class Message