Class InstallRequest

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

public class InstallRequest extends AbstractRaftRequest
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.

  • 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

      public static InstallRequest.Builder 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

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

      public long index()
      Returns the snapshot index.
      Returns:
      The snapshot index.
    • chunkId

      public ByteBuffer chunkId()
      Returns the id of the snapshot chunk.
      Returns:
      The id of the snapshot chunk.
    • nextChunkId

      public ByteBuffer 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

      public ByteBuffer 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()
      Overrides:
      hashCode in class Object
    • equals

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

      public String toString()
      Overrides:
      toString in class Object
    • from

      public MemberId from()