Package io.atomix.raft.protocol
Class InstallRequest.Builder
java.lang.Object
io.atomix.raft.protocol.AbstractRaftRequest.Builder<InstallRequest.Builder,InstallRequest>
io.atomix.raft.protocol.InstallRequest.Builder
- All Implemented Interfaces:
RaftRequest.Builder<InstallRequest.Builder,,InstallRequest> Builder<InstallRequest>
- Enclosing class:
InstallRequest
public static class InstallRequest.Builder
extends AbstractRaftRequest.Builder<InstallRequest.Builder,InstallRequest>
Snapshot request builder.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()protected voidvalidate()Validates the builder.withChunkId(ByteBuffer chunkId) Sets the request chunk ID.withComplete(boolean complete) Sets whether the request is complete.withCurrentTerm(long currentTerm) Sets the request current term.withData(ByteBuffer data) Sets the request snapshot bytes.withIndex(long index) Sets the request index.withInitial(boolean initial) Sets whether this is the first chunk of a snapshot.withLeader(MemberId leader) Sets the request leader.withNextChunkId(ByteBuffer nextChunkId) Sets the request offset.withTerm(long term) withVersion(int version) Sets the request version.Methods inherited from class io.atomix.raft.protocol.AbstractRaftRequest.Builder
toString
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withCurrentTerm
Sets the request current term.- Parameters:
currentTerm- The request current term.- Returns:
- The append request builder.
- Throws:
IllegalArgumentException- if thecurrentTermis not positive
-
withLeader
Sets the request leader.- Parameters:
leader- The request leader.- Returns:
- The append request builder.
- Throws:
IllegalArgumentException- if theleaderis not positive
-
withTerm
-
withIndex
Sets the request index.- Parameters:
index- The request index.- Returns:
- The request builder.
-
withVersion
Sets the request version.- Parameters:
version- the request version- Returns:
- the request builder
-
withChunkId
Sets the request chunk ID.- Parameters:
chunkId- The request chunk ID.- Returns:
- The request builder.
-
withNextChunkId
Sets the request offset.- Parameters:
nextChunkId- The request offset.- Returns:
- The request builder.
-
withData
Sets the request snapshot bytes.- Parameters:
data- The snapshot bytes.- Returns:
- The request builder.
-
withComplete
Sets whether the request is complete.- Parameters:
complete- Whether the snapshot is complete.- Returns:
- The request builder.
- Throws:
NullPointerException- ifmemberis null
-
withInitial
Sets whether this is the first chunk of a snapshot.- Parameters:
initial- whether this is the first chunk of a snapshot- Returns:
- the request builder
-
build
- Throws:
IllegalStateException- if member is null
-
validate
protected void validate()Description copied from class:AbstractRaftRequest.BuilderValidates the builder.- Overrides:
validatein classAbstractRaftRequest.Builder<InstallRequest.Builder,InstallRequest>
-