public interface FSMCaller extends Lifecycle<FSMCallerOptions>, Describer
| Modifier and Type | Interface and Description |
|---|---|
static interface |
FSMCaller.LastAppliedLogIndexListener
Listen on lastAppliedLogIndex update events.
|
Describer.DefaultPrinter, Describer.Printer| Modifier and Type | Method and Description |
|---|---|
void |
addLastAppliedLogIndexListener(FSMCaller.LastAppliedLogIndexListener listener)
Adds a LastAppliedLogIndexListener.
|
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.
|
boolean |
hasAvailableCapacity(int requiredCapacity)
Given specified requiredCapacity determines if that amount of space
is available to submit new tasks to fsm.
|
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.
|
boolean isRunningOnFSMThread()
void addLastAppliedLogIndexListener(FSMCaller.LastAppliedLogIndexListener listener)
boolean onCommitted(long committedIndex)
committedIndex - committed log indexboolean hasAvailableCapacity(int requiredCapacity)
requiredCapacity - boolean onSnapshotLoad(LoadSnapshotClosure done)
done - callbackvoid onSnapshotSaveSync(SaveSnapshotClosure done)
done - boolean onSnapshotSave(SaveSnapshotClosure done)
done - callbackboolean onLeaderStop(Status status)
status - status infoboolean onLeaderStart(long term)
term - current termboolean onStartFollowing(LeaderChangeContext ctx)
ctx - context of leader changeboolean onStopFollowing(LeaderChangeContext ctx)
ctx - context of leader changeboolean onError(RaftException error)
error - error infolong getLastAppliedIndex()
long getLastCommittedIndex()
void join() throws InterruptedException
InterruptedException - if the current thread is interrupted
while waitingCopyright © 2024. All rights reserved.