Package io.atomix.raft.protocol
Class AppendRequest
java.lang.Object
io.atomix.raft.protocol.AbstractRaftRequest
io.atomix.raft.protocol.AppendRequest
- All Implemented Interfaces:
RaftMessage,RaftRequest
Append entries request that represent old version (version = 1) which only replicated the raft
entry and not the complete serialized journal record.
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.
-
Nested Class Summary
Nested classes/interfaces inherited from class io.atomix.raft.protocol.AbstractRaftRequest
AbstractRaftRequest.Builder<T extends AbstractRaftRequest.Builder<T,U>, U extends AbstractRaftRequest> -
Constructor Summary
ConstructorsConstructorDescriptionAppendRequest(long term, String leader, long prevLogIndex, long prevLogTerm, List<PersistedRaftRecord> entries, long commitIndex) -
Method Summary
Modifier and TypeMethodDescriptionlongReturns the leader's commit index.entries()Returns the log entries to append.booleanfrom()inthashCode()leader()Returns the requesting leader address.longReturns the index of the log entry preceding the new entry.longReturns the term of the log entry preceding the new entry.longterm()Returns the requesting node's current term.toString()
-
Constructor Details
-
AppendRequest
public AppendRequest(long term, String leader, long prevLogIndex, long prevLogTerm, List<PersistedRaftRecord> entries, long commitIndex)
-
-
Method Details
-
term
public long term()Returns the requesting node's current term.- Returns:
- The requesting node's current term.
-
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
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() -
equals
-
toString
-
from
-