Package io.atomix.raft.roles
Class LeaderRole
java.lang.Object
io.atomix.raft.roles.AbstractRole
io.atomix.raft.roles.InactiveRole
io.atomix.raft.roles.PassiveRole
io.atomix.raft.roles.ActiveRole
io.atomix.raft.roles.LeaderRole
- All Implemented Interfaces:
RaftRole,ZeebeLogAppender,Managed<RaftRole>,AutoCloseable
Leader state.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.atomix.raft.zeebe.ZeebeLogAppender
ZeebeLogAppender.AppendListener -
Field Summary
Fields inherited from class io.atomix.raft.roles.AbstractRole
log, raft -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidappendEntry(long lowestPosition, long highestPosition, BufferWriter data, ZeebeLogAppender.AppendListener appendListener) Appends an entry to the local Raft log and schedules replication to each follower.voidappendEntry(long lowestPosition, long highestPosition, ByteBuffer data, ZeebeLogAppender.AppendListener appendListener) Appends an entry to the local Raft log and schedules replication to each follower.voidappendEntry(ApplicationEntry entry, ZeebeLogAppender.AppendListener appendListener) Appends an entry to the local Raft log and schedules replication to each follower.onAppend(InternalAppendRequest request) Handles an append request.onConfigure(ConfigureRequest request) Handles a configure request.onForceConfigure(ForceConfigureRequest request) Handles a force configure request.voidonInitialEntriesCommitted(Runnable runnable) onJoin(JoinRequest request) Handles a request to join the cluster.onLeave(LeaveRequest request) Handles a request to leave the cluster.onPoll(PollRequest request) Handles a poll request.onReconfigure(ReconfigureRequest request) Handles a configure request.onTransfer(TransferRequest request) Handles a transfer request.onVote(VoteRequest request) Handles a vote request.role()Returns the server state type.start()stop()Methods inherited from class io.atomix.raft.roles.ActiveRole
handlePoll, handleVoteMethods inherited from class io.atomix.raft.roles.PassiveRole
appendEntries, checkPreviousEntry, checkTerm, completeAppend, failAppend, handleAppend, onInstall, succeedAppendMethods inherited from class io.atomix.raft.roles.AbstractRole
forward, isRunning, logRequest, logResponse, shouldAcceptRequest, toString, updateTermAndLeader
-
Constructor Details
-
LeaderRole
-
-
Method Details
-
start
- Specified by:
startin interfaceManaged<RaftRole>- Overrides:
startin classPassiveRole
-
stop
- Specified by:
stopin interfaceManaged<RaftRole>- Overrides:
stopin classPassiveRole
-
role
Description copied from interface:RaftRoleReturns the server state type.- Specified by:
rolein interfaceRaftRole- Overrides:
rolein classPassiveRole- Returns:
- The server state type.
-
onReconfigure
Description copied from interface:RaftRoleHandles a configure request.- Specified by:
onReconfigurein interfaceRaftRole- Overrides:
onReconfigurein classPassiveRole- Parameters:
request- The request to handle.- Returns:
- A completable future to be completed with the request response.
-
onForceConfigure
Description copied from interface:RaftRoleHandles a force configure request. The request is never received from a leader. This is typically requested to remove a set of (unavailable) members when a quorum is not possible.- Specified by:
onForceConfigurein interfaceRaftRole- Overrides:
onForceConfigurein classPassiveRole
-
onJoin
Description copied from interface:RaftRoleHandles a request to join the cluster.- Specified by:
onJoinin interfaceRaftRole- Overrides:
onJoinin classPassiveRole
-
onLeave
Description copied from interface:RaftRoleHandles a request to leave the cluster.- Specified by:
onLeavein interfaceRaftRole- Overrides:
onLeavein classPassiveRole
-
onConfigure
Description copied from interface:RaftRoleHandles a configure request.- Specified by:
onConfigurein interfaceRaftRole- Overrides:
onConfigurein classInactiveRole- Parameters:
request- The request to handle.- Returns:
- A completable future to be completed with the request response.
-
onTransfer
Description copied from interface:RaftRoleHandles a transfer request.- Specified by:
onTransferin interfaceRaftRole- Overrides:
onTransferin classInactiveRole- Parameters:
request- The request to handle.- Returns:
- A completable future to be completed with the request response.
-
onAppend
Description copied from interface:RaftRoleHandles an append request.- Specified by:
onAppendin interfaceRaftRole- Overrides:
onAppendin classActiveRole- Parameters:
request- The request to handle.- Returns:
- A completable future to be completed with the request response.
-
onPoll
Description copied from interface:RaftRoleHandles a poll request.- Specified by:
onPollin interfaceRaftRole- Overrides:
onPollin classActiveRole- Parameters:
request- The request to handle.- Returns:
- A completable future to be completed with the request response.
-
onVote
Description copied from interface:RaftRoleHandles a vote request.- Specified by:
onVotein interfaceRaftRole- Overrides:
onVotein classActiveRole- Parameters:
request- The request to handle.- Returns:
- A completable future to be completed with the request response.
-
appendEntry
Description copied from interface:ZeebeLogAppenderAppends an entry to the local Raft log and schedules replication to each follower.- Specified by:
appendEntryin interfaceZeebeLogAppender
-
appendEntry
public void appendEntry(long lowestPosition, long highestPosition, ByteBuffer data, ZeebeLogAppender.AppendListener appendListener) Description copied from interface:ZeebeLogAppenderAppends an entry to the local Raft log and schedules replication to each follower.- Specified by:
appendEntryin interfaceZeebeLogAppender- Parameters:
lowestPosition- lowest record position in the data bufferhighestPosition- highest record position in the data bufferdata- data to store in the entry
-
appendEntry
public void appendEntry(long lowestPosition, long highestPosition, BufferWriter data, ZeebeLogAppender.AppendListener appendListener) Description copied from interface:ZeebeLogAppenderAppends an entry to the local Raft log and schedules replication to each follower.- Specified by:
appendEntryin interfaceZeebeLogAppender- Parameters:
lowestPosition- lowest record position in the data bufferhighestPosition- highest record position in the data bufferdata- data to store in the entry
-
onInitialEntriesCommitted
-