Package io.atomix.raft.protocol
Class AppendResponse.Builder
java.lang.Object
io.atomix.raft.protocol.AbstractRaftResponse.Builder<AppendResponse.Builder,AppendResponse>
io.atomix.raft.protocol.AppendResponse.Builder
- All Implemented Interfaces:
RaftResponse.Builder<AppendResponse.Builder,,AppendResponse> Builder<AppendResponse>
- Enclosing class:
- AppendResponse
public static class AppendResponse.Builder
extends AbstractRaftResponse.Builder<AppendResponse.Builder,AppendResponse>
Append response builder.
-
Field Summary
Fields inherited from class io.atomix.raft.protocol.AbstractRaftResponse.Builder
error, status -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()protected voidvalidate()Validates the builder.withLastLogIndex(long lastLogIndex) Sets the last index of the replica's log.withLastSnapshotIndex(long lastSnapshotIndex) withSucceeded(boolean succeeded) Sets whether the request succeeded.withTerm(long term) Sets the response term.Methods inherited from class io.atomix.raft.protocol.AbstractRaftResponse.Builder
toString, withError, withStatusMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.atomix.raft.protocol.RaftResponse.Builder
withError, withError
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
withTerm
Sets the response term.- Parameters:
term- The response term.- Returns:
- The append response builder
- Throws:
IllegalArgumentException- iftermis not positive
-
withSucceeded
Sets whether the request succeeded.- Parameters:
succeeded- Whether the append request succeeded.- Returns:
- The append response builder.
-
withLastLogIndex
Sets the last index of the replica's log.- Parameters:
lastLogIndex- The last index of the replica's log.- Returns:
- The append response builder.
- Throws:
IllegalArgumentException- ifindexis negative
-
withLastSnapshotIndex
-
build
- Throws:
IllegalStateException- if status is ok and term is not positive or log index is negative
-
validate
protected void validate()Description copied from class:AbstractRaftResponse.BuilderValidates the builder.- Overrides:
validatein classAbstractRaftResponse.Builder<AppendResponse.Builder,AppendResponse>
-