Package io.atomix.raft.protocol
Class InstallRequest
java.lang.Object
io.atomix.raft.protocol.AbstractRaftRequest
io.atomix.raft.protocol.InstallRequest
- All Implemented Interfaces:
RaftMessage,RaftRequest
Server snapshot installation request.
Snapshot installation requests are sent by the leader to a follower when the follower
indicates that its log is further behind than the last snapshot taken by the leader. Snapshots
are sent in chunks, with each chunk being sent in a separate install request. As requests are
received by the follower, the snapshot is reconstructed based on the provided chunkId()
and other metadata. The last install request will be sent with complete() being
true to indicate that all chunks of the snapshot have been sent.
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionInstallRequest(long currentTerm, MemberId leader, long index, long term, int version, ByteBuffer chunkId, ByteBuffer nextChunkId, ByteBuffer data, boolean initial, boolean complete) -
Method Summary
Modifier and TypeMethodDescriptionstatic InstallRequest.Builderbuilder()Returns a new install request builder.chunkId()Returns the id of the snapshot chunk.booleancomplete()Returns a boolean value indicating whether this is the last chunk of the snapshot.longReturns the requesting node's current term.data()Returns the snapshot data.booleaninthashCode()longindex()Returns the snapshot index.booleanleader()Returns the requesting leader address.Returns the ID of the next expected chunk; may be nulllongterm()Returns the term of the last applied entry in the snapshot.toString()
-
Constructor Details
-
InstallRequest
public InstallRequest(long currentTerm, MemberId leader, long index, long term, int version, ByteBuffer chunkId, ByteBuffer nextChunkId, ByteBuffer data, boolean initial, boolean complete)
-
-
Method Details
-
builder
Returns a new install request builder.- Returns:
- A new install request builder.
-
currentTerm
public long currentTerm()Returns the requesting node's current term.- Returns:
- The requesting node's current term.
-
term
public long term()Returns the term of the last applied entry in the snapshot.- Returns:
- The snapshot term.
-
leader
Returns the requesting leader address.- Returns:
- The leader's address.
-
index
public long index()Returns the snapshot index.- Returns:
- The snapshot index.
-
chunkId
Returns the id of the snapshot chunk.- Returns:
- The id of the snapshot chunk.
-
nextChunkId
Returns the ID of the next expected chunk; may be null- Returns:
- the Id of the next expected chunk.
-
isInitial
public boolean isInitial()- Returns:
- true if this is the first chunk of a snapshot
-
data
Returns the snapshot data.- Returns:
- The snapshot data.
-
complete
public boolean complete()Returns a boolean value indicating whether this is the last chunk of the snapshot.- Returns:
- Indicates whether this request is the last chunk of the snapshot.
-
hashCode
public int hashCode() -
equals
-
toString
-