Class Shard
java.lang.Object
org.apache.pekko.actor.AbstractActor
org.apache.pekko.persistence.AbstractPersistentActor
org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActor
org.opendaylight.controller.cluster.raft.RaftActor
org.opendaylight.controller.cluster.datastore.Shard
- All Implemented Interfaces:
org.apache.pekko.actor.Actor
,org.apache.pekko.actor.Stash
,org.apache.pekko.actor.StashFactory
,org.apache.pekko.actor.StashSupport
,org.apache.pekko.actor.UnrestrictedStash
,org.apache.pekko.dispatch.RequiresMessageQueue<org.apache.pekko.dispatch.DequeBasedMessageQueueSemantics>
,org.apache.pekko.persistence.AbstractPersistentActorLike
,org.apache.pekko.persistence.Eventsourced
,org.apache.pekko.persistence.PersistenceIdentity
,org.apache.pekko.persistence.PersistenceRecovery
,org.apache.pekko.persistence.PersistenceStash
,org.apache.pekko.persistence.Snapshotter
,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 class
Shard.AbstractBuilder<T extends Shard.AbstractBuilder<T,
S>, S extends Shard> static class
Nested classes/interfaces inherited from class org.apache.pekko.actor.AbstractActor
org.apache.pekko.actor.AbstractActor.ActorContext, org.apache.pekko.actor.AbstractActor.Receive
Nested classes/interfaces inherited from interface org.apache.pekko.actor.Actor
org.apache.pekko.actor.Actor.emptyBehavior$, org.apache.pekko.actor.Actor.ignoringBehavior$
Nested classes/interfaces inherited from interface org.apache.pekko.persistence.Eventsourced
org.apache.pekko.persistence.Eventsourced.AsyncHandlerInvocation, org.apache.pekko.persistence.Eventsourced.AsyncHandlerInvocation$, org.apache.pekko.persistence.Eventsourced.PendingHandlerInvocation, org.apache.pekko.persistence.Eventsourced.RecoveryTick, org.apache.pekko.persistence.Eventsourced.RecoveryTick$, org.apache.pekko.persistence.Eventsourced.StashingHandlerInvocation, org.apache.pekko.persistence.Eventsourced.StashingHandlerInvocation$
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionprotected final void
applyCommand
(Identifier identifier, StateCommand command) Apply aStateCommand
to update the actor's state.static Shard.Builder
builder()
protected final RaftActorRecoveryCohort
Returns the RaftActorRecoveryCohort to participate in persistence recovery.protected final org.opendaylight.controller.cluster.datastore.ShardSnapshotCohort
Returns the RaftActorSnapshotCohort to participate in snapshot captures.protected void
handleNonRaftCommand
(Object message) Method exposed for subclasses to plug-in their logic.protected final void
handleRecover
(Object message) protected boolean
final String
protected final OnDemandRaftState.AbstractBuilder
<?, ?> protected final void
onLeaderChanged
(String oldLeader, String newLeader) protected void
This method is called when recovery is complete.protected final void
This method will be called by the RaftActor when the state of the RaftActor changes.protected final void
pauseLeader
(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 void
postStop()
protected final org.apache.pekko.actor.ActorRef
Notifier Actor for this RaftActor to notify when a role change happens.protected final void
This method is invoked when the actions hooked to the leader becoming paused failed to execute and the leader should resume normal operations.protected final LeaderStateChanged
Methods inherited from class org.opendaylight.controller.cluster.raft.RaftActor
deleteSnapshot, deleteSnapshots, getCurrentBehavior, getLeader, getLeaderId, getRaftActorContext, getRaftState, getSender, handleCommand, handleCommandImpl, isLeader, isLeaderActive, isLeadershipTransferInProgress, isRecoveryApplicable, loadSnapshot, memberId, onVotingStateChangeComplete, overridePekkoRecoveredLog, persist, persistAsync, persistence, preStart, saveSnapshot, setPeerAddress, setPersistence, submitCommand, updateConfigParams
Methods inherited from class org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActor
createReceive, createReceiveRecover, executeInSelf, getContext, ignoreMessage, persistenceId, unknownMessage
Methods inherited from class org.apache.pekko.persistence.AbstractPersistentActor
aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, clearStash, createStash, defer, deferAsync, deleteMessages, internalDefer, internalDeferAsync, internalDeleteMessagesBeforeSnapshot, internalPersist, internalPersistAll, internalPersistAllAsync, internalPersistAsync, internalStashOverflowStrategy, journal, lastSequenceNr, mailbox, onPersistFailure, onPersistRejected, onRecoveryFailure, onReplaySuccess, org$apache$pekko$actor$StashSupport$_setter_$mailbox_$eq, org$apache$pekko$actor$StashSupport$_setter_$org$apache$pekko$actor$StashSupport$$capacity_$eq, org$apache$pekko$actor$StashSupport$$capacity, org$apache$pekko$actor$StashSupport$$theStash, org$apache$pekko$actor$StashSupport$$theStash_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$extension_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$instanceId_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$internalStash_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$maxMessageBatchSize_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$pendingInvocations_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$persistingEvents_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$processingCommands_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$unstashFilterPredicate_$eq, org$apache$pekko$persistence$Eventsourced$_setter_$org$apache$pekko$persistence$Eventsourced$$writerUuid_$eq, org$apache$pekko$persistence$Eventsourced$$_lastSequenceNr, org$apache$pekko$persistence$Eventsourced$$_lastSequenceNr_$eq, org$apache$pekko$persistence$Eventsourced$$currentState, org$apache$pekko$persistence$Eventsourced$$currentState_$eq, org$apache$pekko$persistence$Eventsourced$$eventBatch, org$apache$pekko$persistence$Eventsourced$$eventBatch_$eq, org$apache$pekko$persistence$Eventsourced$$extension, org$apache$pekko$persistence$Eventsourced$$instanceId, org$apache$pekko$persistence$Eventsourced$$internalStash, org$apache$pekko$persistence$Eventsourced$$journalBatch, org$apache$pekko$persistence$Eventsourced$$journalBatch_$eq, org$apache$pekko$persistence$Eventsourced$$maxMessageBatchSize, org$apache$pekko$persistence$Eventsourced$$pendingInvocations, org$apache$pekko$persistence$Eventsourced$$pendingStashingPersistInvocations, org$apache$pekko$persistence$Eventsourced$$pendingStashingPersistInvocations_$eq, org$apache$pekko$persistence$Eventsourced$$persistingEvents, org$apache$pekko$persistence$Eventsourced$$processingCommands, org$apache$pekko$persistence$Eventsourced$$sequenceNr, org$apache$pekko$persistence$Eventsourced$$sequenceNr_$eq, org$apache$pekko$persistence$Eventsourced$$unstashFilterPredicate, org$apache$pekko$persistence$Eventsourced$$writeInProgress, org$apache$pekko$persistence$Eventsourced$$writeInProgress_$eq, org$apache$pekko$persistence$Eventsourced$$writerUuid, persistAll, persistAllAsync, prepend, preRestart, receiveCommand, receiveRecover, recovery, recoveryFinished, recoveryRunning, snapshotPluginId, snapshotSequenceNr, snapshotStore, snapshotterId, stash, unhandled, unstash, unstashAll, unstashAll
Methods 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, receive, receiveBuilder, self, sender, supervisorStrategy
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.apache.pekko.actor.Actor
context, org$apache$pekko$actor$Actor$_setter_$context_$eq, org$apache$pekko$actor$Actor$_setter_$self_$eq, postRestart, receive, self, sender, supervisorStrategy
Methods inherited from interface org.apache.pekko.persistence.Eventsourced
org$apache$pekko$persistence$Eventsourced$$changeState, org$apache$pekko$persistence$Eventsourced$$flushBatch, org$apache$pekko$persistence$Eventsourced$$flushJournalBatch, org$apache$pekko$persistence$Eventsourced$$log, org$apache$pekko$persistence$Eventsourced$$peekApplyHandler, org$apache$pekko$persistence$Eventsourced$$recovering, org$apache$pekko$persistence$Eventsourced$$setLastSequenceNr, org$apache$pekko$persistence$Eventsourced$$startRecovery, org$apache$pekko$persistence$Eventsourced$$stashInternally, org$apache$pekko$persistence$Eventsourced$$unstashInternally, org$apache$pekko$persistence$Eventsourced$$updateLastSequenceNr, org$apache$pekko$persistence$Eventsourced$$writeEventFailed, org$apache$pekko$persistence$Eventsourced$$writeEventRejected, org$apache$pekko$persistence$Eventsourced$$writeEventSucceeded
Methods inherited from interface org.apache.pekko.actor.StashSupport
context, self
-
Field Details
-
DEFAULT_NAME
- See Also:
-
NON_PERSISTENT_JOURNAL_ID
- See Also:
-
-
Method Details
-
postStop
-
handleRecover
- Overrides:
handleRecover
in classRaftActor
- Throws:
Exception
-
handleNonRaftCommand
Description copied from class:RaftActor
Method exposed for subclasses to plug-in their logic. This method is invoked byRaftActor.handleCommand(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:
handleNonRaftCommand
in classRaftActor
- Parameters:
message
- Incoming command message
-
roleChangeNotifier
protected final org.apache.pekko.actor.ActorRef roleChangeNotifier()Description copied from class:RaftActor
Notifier Actor for this RaftActor to notify when a role change happens.- Specified by:
roleChangeNotifier
in classRaftActor
- Returns:
- ActorRef - ActorRef of the notifier or
null
if none.
-
wrapLeaderStateChanged
- Overrides:
wrapLeaderStateChanged
in classRaftActor
-
isIsolatedLeader
protected boolean isIsolatedLeader() -
getRaftActorSnapshotCohort
protected final org.opendaylight.controller.cluster.datastore.ShardSnapshotCohort getRaftActorSnapshotCohort()Description copied from class:RaftActor
Returns the RaftActorSnapshotCohort to participate in snapshot captures.- Specified by:
getRaftActorSnapshotCohort
in classRaftActor
-
getRaftActorRecoveryCohort
Description copied from class:RaftActor
Returns the RaftActorRecoveryCohort to participate in persistence recovery.- Specified by:
getRaftActorRecoveryCohort
in classRaftActor
-
onRecoveryComplete
protected void onRecoveryComplete()Description copied from class:RaftActor
This method is called when recovery is complete.- Specified by:
onRecoveryComplete
in classRaftActor
-
applyCommand
Description copied from class:RaftActor
Apply aStateCommand
to update the actor's state.- Specified by:
applyCommand
in 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 benull
when the RaftActor is behaving as a follower or during recoverycommand
- theStateCommand
to apply
-
onStateChanged
protected final void onStateChanged()Description copied from class:RaftActor
This 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:
onStateChanged
in classRaftActor
-
onLeaderChanged
- Overrides:
onLeaderChanged
in classRaftActor
-
pauseLeader
Description copied from class:RaftActor
This 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:
pauseLeader
in classRaftActor
- Parameters:
operation
- the operation to run
-
unpauseLeader
protected final void unpauseLeader()Description copied from class:RaftActor
This 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:
unpauseLeader
in classRaftActor
-
newOnDemandRaftStateBuilder
- Overrides:
newOnDemandRaftStateBuilder
in classRaftActor
-
journalPluginId
- Specified by:
journalPluginId
in interfaceorg.apache.pekko.persistence.PersistenceIdentity
- Overrides:
journalPluginId
in classorg.apache.pekko.persistence.AbstractPersistentActor
-
builder
-