Class AppendRequest

java.lang.Object
io.atomix.raft.protocol.AbstractRaftRequest
io.atomix.raft.protocol.AppendRequest
All Implemented Interfaces:
RaftMessage, RaftRequest

public class AppendRequest extends AbstractRaftRequest
Append entries request.

Append entries requests are at the core of the replication protocol. Leaders send append requests to followers to replicate and commit log entries, and followers sent append requests to passive members to replicate committed log entries.

  • Constructor Details

    • AppendRequest

      public AppendRequest(long term, String leader, long prevLogIndex, long prevLogTerm, List<PersistedRaftRecord> entries, long commitIndex)
  • Method Details

    • builder

      public static AppendRequest.Builder builder()
      Returns a new append request builder.
      Returns:
      A new append request builder.
    • term

      public long term()
      Returns the requesting node's current term.
      Returns:
      The requesting node's current term.
    • leader

      public MemberId leader()
      Returns the requesting leader address.
      Returns:
      The leader's address.
    • prevLogIndex

      public long prevLogIndex()
      Returns the index of the log entry preceding the new entry.
      Returns:
      The index of the log entry preceding the new entry.
    • prevLogTerm

      public long prevLogTerm()
      Returns the term of the log entry preceding the new entry.
      Returns:
      The index of the term preceding the new entry.
    • entries

      public List<PersistedRaftRecord> entries()
      Returns the log entries to append.
      Returns:
      A list of log entries.
    • commitIndex

      public long commitIndex()
      Returns the leader's commit index.
      Returns:
      The leader commit index.
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object object)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object