public abstract class StateMachineAdapter extends Object implements StateMachine
StateMachine.onApply(com.alipay.sofa.jraft.Iterator).| Constructor and Description |
|---|
StateMachineAdapter() |
| Modifier and Type | Method and Description |
|---|---|
void |
onConfigurationCommitted(Configuration conf)
Invoked when a configuration has been committed to the group.
|
void |
onError(RaftException e)
This method is called when a critical error was encountered, after this
point, no any further modification is allowed to applied to this node
until the error is fixed and this node restarts.
|
void |
onLeaderStart(long term)
Invoked when the belonging node becomes the leader of the group at |term|
Default: Do nothing
|
void |
onLeaderStop(Status status)
Invoked when this node steps down from the leader of the replication
group and |status| describes detailed information
|
void |
onShutdown()
Invoked once when the raft node was shut down.
|
boolean |
onSnapshotLoad(SnapshotReader reader)
User defined snapshot load function
get and load snapshot
Default: Load nothing and returns error.
|
void |
onSnapshotSave(SnapshotWriter writer,
Closure done)
User defined snapshot generate function, this method will block StateMachine#onApply(Iterator).
|
void |
onStartFollowing(LeaderChangeContext ctx)
This method is called when a follower or candidate starts following a leader and its leaderId
(should be NULL before the method is called) is set to the leader's id,
situations including:
1.
|
void |
onStopFollowing(LeaderChangeContext ctx)
This method is called when a follower stops following a leader and its leaderId becomes null,
situations including:
1.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitonApplypublic void onShutdown()
StateMachineonShutdown in interface StateMachinepublic void onSnapshotSave(SnapshotWriter writer, Closure done)
StateMachineonSnapshotSave in interface StateMachinewriter - snapshot writerdone - callbackpublic boolean onSnapshotLoad(SnapshotReader reader)
StateMachineonSnapshotLoad in interface StateMachinereader - snapshot readerpublic void onLeaderStart(long term)
StateMachineonLeaderStart in interface StateMachineterm - new term numpublic void onLeaderStop(Status status)
StateMachineonLeaderStop in interface StateMachinestatus - status infopublic void onError(RaftException e)
StateMachineonError in interface StateMachinee - raft error messagepublic void onConfigurationCommitted(Configuration conf)
StateMachineonConfigurationCommitted in interface StateMachineconf - committed configurationpublic void onStopFollowing(LeaderChangeContext ctx)
StateMachineonStopFollowing in interface StateMachinectx - context of leader changepublic void onStartFollowing(LeaderChangeContext ctx)
StateMachineonStartFollowing in interface StateMachinectx - context of leader changeCopyright © 2024. All rights reserved.