| Modifier and Type | Class and Description |
|---|---|
class |
FSMCallerImpl.OnErrorClosure
Closure runs with an error.
|
FSMCaller.LastAppliedLogIndexListenerDescriber.DefaultPrinter, Describer.Printer| Constructor and Description |
|---|
FSMCallerImpl() |
| Modifier and Type | Method and Description |
|---|---|
void |
addLastAppliedLogIndexListener(FSMCaller.LastAppliedLogIndexListener listener)
Adds a LastAppliedLogIndexListener.
|
void |
describe(Describer.Printer out) |
long |
getLastAppliedIndex()
Returns the last log entry index to apply state machine.
|
long |
getLastCommittedIndex()
Returns the last log entry that was committed to raft group.
|
NodeImpl |
getNode() |
boolean |
hasAvailableCapacity(int requiredCapacity)
Given specified requiredCapacity determines if that amount of space
is available to submit new tasks to fsm.
|
boolean |
init(FSMCallerOptions opts)
Initialize the service.
|
boolean |
isRunningOnFSMThread()
Returns true when current thread is the thread that calls state machine callback methods.
|
void |
join()
Called after shutdown to wait it terminates.
|
boolean |
onCommitted(long committedIndex)
Called when log entry committed
|
boolean |
onError(RaftException error)
Called when error happens.
|
boolean |
onLeaderStart(long term)
Called when the leader starts.
|
boolean |
onLeaderStop(Status status)
Called when the leader stops.
|
boolean |
onSnapshotLoad(LoadSnapshotClosure done)
Called when loading snapshot.
|
boolean |
onSnapshotSave(SaveSnapshotClosure done)
Called when saving snapshot.
|
void |
onSnapshotSaveSync(SaveSnapshotClosure done)
Called when saving snapshot synchronously, it MUST be called in state machine methods.
|
boolean |
onStartFollowing(LeaderChangeContext ctx)
Called when start following a leader.
|
boolean |
onStopFollowing(LeaderChangeContext ctx)
Called when stop following a leader.
|
void |
shutdown()
Dispose the resources for service.
|
String |
toString() |
public boolean init(FSMCallerOptions opts)
Lifecycleinit in interface Lifecycle<FSMCallerOptions>public void shutdown()
Lifecycleshutdown in interface Lifecycle<FSMCallerOptions>public void addLastAppliedLogIndexListener(FSMCaller.LastAppliedLogIndexListener listener)
FSMCalleraddLastAppliedLogIndexListener in interface FSMCallerpublic boolean hasAvailableCapacity(int requiredCapacity)
FSMCallerhasAvailableCapacity in interface FSMCallerpublic boolean onCommitted(long committedIndex)
FSMCalleronCommitted in interface FSMCallercommittedIndex - committed log indexpublic boolean onSnapshotLoad(LoadSnapshotClosure done)
FSMCalleronSnapshotLoad in interface FSMCallerdone - callbackpublic boolean onSnapshotSave(SaveSnapshotClosure done)
FSMCalleronSnapshotSave in interface FSMCallerdone - callbackpublic boolean onLeaderStop(Status status)
FSMCalleronLeaderStop in interface FSMCallerstatus - status infopublic boolean onLeaderStart(long term)
FSMCalleronLeaderStart in interface FSMCallerterm - current termpublic boolean onStartFollowing(LeaderChangeContext ctx)
FSMCalleronStartFollowing in interface FSMCallerctx - context of leader changepublic boolean onStopFollowing(LeaderChangeContext ctx)
FSMCalleronStopFollowing in interface FSMCallerctx - context of leader changepublic boolean onError(RaftException error)
FSMCallerpublic long getLastCommittedIndex()
FSMCallergetLastCommittedIndex in interface FSMCallerpublic long getLastAppliedIndex()
FSMCallergetLastAppliedIndex in interface FSMCallerpublic NodeImpl getNode()
public void join()
throws InterruptedException
FSMCallerjoin in interface FSMCallerInterruptedException - if the current thread is interrupted
while waitingpublic boolean isRunningOnFSMThread()
FSMCallerisRunningOnFSMThread in interface FSMCallerpublic void onSnapshotSaveSync(SaveSnapshotClosure done)
FSMCalleronSnapshotSaveSync in interface FSMCallerpublic void describe(Describer.Printer out)
Copyright © 2024. All rights reserved.