Class Shard
java.lang.Object
org.apache.pekko.actor.AbstractActor
org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor
org.opendaylight.controller.cluster.raft.RaftActor
org.opendaylight.controller.cluster.datastore.Shard
- All Implemented Interfaces:
Actor,ExecuteInSelfActor
A Shard represents a portion of the logical data tree.
Our Shard uses InMemoryDataTree as its internal representation and delegates all requests it
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classShard.AbstractBuilder<T extends Shard.AbstractBuilder<T,S>, S extends Shard> static classNested classes/interfaces inherited from class org.apache.pekko.actor.AbstractActor
AbstractActor.ActorContext, AbstractActor.ReceiveNested classes/interfaces inherited from interface org.apache.pekko.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$ -
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected final voidapplyCommand(Identifier identifier, StateCommand command) Apply aStateCommandto update the actor's state.static Shard.Builderbuilder()protected final RaftActorRecoveryCohortReturns the RaftActorRecoveryCohort to participate in persistence recovery.protected final org.opendaylight.controller.cluster.datastore.ShardSnapshotCohortReturns the RaftActorSnapshotCohort to participate in snapshot captures.protected final SnapshotReturns the snapshot to restore from on recovery.protected voidhandleNonRaftCommand(Object message) Method exposed for subclasses to plug-in their logic.protected booleanprotected final OnDemandRaftState.AbstractBuilder<?, ?> protected final voidonLeaderChanged(String oldLeader, String newLeader) protected voidThis method is called when recovery is complete.protected final voidThis method will be called by the RaftActor when the state of the RaftActor changes.protected final voidpauseLeader(Runnable operation) This method is called prior to operations such as leadership transfer and actor shutdown when the leader must pause or stop its duties.final voidpostStop()protected final RecoveryObserverprotected final ActorRefNotifier Actor for this RaftActor to notify when a role change happens.protected final voidThis method is invoked when the actions hooked to the leader becoming paused failed to execute and the leader should resume normal operations.protected final LeaderStateChangedMethods inherited from class org.opendaylight.controller.cluster.raft.RaftActor
getCurrentBehavior, getLeader, getLeaderId, getRaftActorContext, getRaftState, getSender, handleCommandImpl, handleReceive, isLeader, isLeaderActive, isLeadershipTransferInProgress, isRecoveryApplicable, memberId, onVotingStateChangeComplete, overridePekkoRecoveredLog, persistence, preStart, setPeerAddress, setPersistence, submitCommand, updateConfigParamsMethods inherited from class org.opendaylight.controller.cluster.common.actor.AbstractUntypedActor
createReceive, executeInSelf, getContext, ignoreMessage, isValidSender, unknownMessageMethods inherited from class org.apache.pekko.actor.AbstractActor
context, emptyBehavior, getSelf, org$apache$pekko$actor$Actor$_setter_$context_$eq, org$apache$pekko$actor$Actor$_setter_$self_$eq, postRestart, preRestart, preRestart, receive, receiveBuilder, self, supervisorStrategyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.pekko.actor.Actor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, sender, unhandled
-
Field Details
-
DEFAULT_NAME
- See Also:
-
-
Method Details
-
postStop
-
recoveryObserver
- Overrides:
recoveryObserverin classRaftActor
-
handleNonRaftCommand
Description copied from class:RaftActorMethod exposed for subclasses to plug-in their logic. This method is invoked byRaftActor.handleReceive(Object)for messages which are not handled by this class. Subclasses overriding this class should fall back to this implementation for messages which they do not handle- Overrides:
handleNonRaftCommandin classRaftActor- Parameters:
message- Incoming command message
-
roleChangeNotifier
Description copied from class:RaftActorNotifier Actor for this RaftActor to notify when a role change happens.- Specified by:
roleChangeNotifierin classRaftActor- Returns:
- ActorRef - ActorRef of the notifier or
nullif none.
-
wrapLeaderStateChanged
- Overrides:
wrapLeaderStateChangedin classRaftActor
-
isIsolatedLeader
protected boolean isIsolatedLeader() -
getRaftActorSnapshotCohort
protected final org.opendaylight.controller.cluster.datastore.ShardSnapshotCohort getRaftActorSnapshotCohort()Description copied from class:RaftActorReturns the RaftActorSnapshotCohort to participate in snapshot captures.- Specified by:
getRaftActorSnapshotCohortin classRaftActor
-
getRaftActorRecoveryCohort
Description copied from class:RaftActorReturns the RaftActorRecoveryCohort to participate in persistence recovery.- Specified by:
getRaftActorRecoveryCohortin classRaftActor
-
getRestoreFromSnapshot
Description copied from class:RaftActorReturns the snapshot to restore from on recovery.- Specified by:
getRestoreFromSnapshotin classRaftActor- Returns:
- the snapshot or null if there's no snapshot to restore
-
onRecoveryComplete
protected void onRecoveryComplete()Description copied from class:RaftActorThis method is called when recovery is complete.- Specified by:
onRecoveryCompletein classRaftActor
-
applyCommand
Description copied from class:RaftActorApply aStateCommandto update the actor's state.- Specified by:
applyCommandin classRaftActor- Parameters:
identifier- The identifier of the persisted data. This is also the same identifier that was passed toRaftActor.submitCommand(Identifier, AbstractStateCommand, boolean)by the derived actor. May benullwhen the RaftActor is behaving as a follower or during recoverycommand- theStateCommandto apply
-
onStateChanged
protected final void onStateChanged()Description copied from class:RaftActorThis method will be called by the RaftActor when the state of the RaftActor changes. The derived actor can then use methods like isLeader or getLeader to do something useful- Specified by:
onStateChangedin classRaftActor
-
onLeaderChanged
- Overrides:
onLeaderChangedin classRaftActor
-
pauseLeader
Description copied from class:RaftActorThis method is called prior to operations such as leadership transfer and actor shutdown when the leader must pause or stop its duties. This method allows derived classes to gracefully pause or finish current work prior to performing the operation. On completion of any work, the run method must be called on the given Runnable to proceed with the given operation. Important: the run method must be called on this actor's thread dispatcher as as it modifies internal state.The default implementation immediately runs the operation.
- Overrides:
pauseLeaderin classRaftActor- Parameters:
operation- the operation to run
-
unpauseLeader
protected final void unpauseLeader()Description copied from class:RaftActorThis method is invoked when the actions hooked to the leader becoming paused failed to execute and the leader should resume normal operations.Note this method can be invoked even before the operation supplied to
RaftActor.pauseLeader(Runnable)is invoked.- Overrides:
unpauseLeaderin classRaftActor
-
newOnDemandRaftStateBuilder
- Overrides:
newOnDemandRaftStateBuilderin classRaftActor
-
builder
-