Class Shard
java.lang.Object
akka.actor.AbstractActor
akka.persistence.AbstractPersistentActor
org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActor
org.opendaylight.controller.cluster.raft.RaftActor
org.opendaylight.controller.cluster.datastore.Shard
- All Implemented Interfaces:
Actor
,Stash
,StashFactory
,StashSupport
,UnrestrictedStash
,RequiresMessageQueue<DequeBasedMessageQueueSemantics>
,AbstractPersistentActorLike
,Eventsourced
,PersistenceIdentity
,PersistenceRecovery
,PersistenceStash
,Snapshotter
,ExecuteInSelfActor
A Shard represents a portion of the logical data tree.
Our Shard uses InMemoryDataTree as it's 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 akka.actor.AbstractActor
AbstractActor.ActorContext, AbstractActor.Receive
Nested classes/interfaces inherited from interface akka.actor.Actor
Actor.emptyBehavior$, Actor.ignoringBehavior$
Nested classes/interfaces inherited from interface akka.persistence.Eventsourced
Eventsourced.AsyncHandlerInvocation, Eventsourced.AsyncHandlerInvocation$, Eventsourced.PendingHandlerInvocation, Eventsourced.RecoveryTick, Eventsourced.RecoveryTick$, Eventsourced.StashingHandlerInvocation, Eventsourced.StashingHandlerInvocation$
-
Field Summary
FieldsFields inherited from class org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActor
LOG
-
Method Summary
Modifier and TypeMethodDescriptionprotected final void
applyState
(ActorRef clientActor, Identifier identifier, Object data) The applyState method will be called by the RaftActor when some data needs to be applied to the actor's state.static Shard.Builder
builder()
protected final RaftActorRecoveryCohort
Returns the RaftActorRecoveryCohort to participate in persistence recovery.protected final RaftActorSnapshotCohort
Returns the RaftActorSnapshotCohort to participate in snapshot captures.Notifier Actor for this RaftActor to notify when a role change happens.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 LeaderStateChanged
newLeaderStateChanged
(String memberId, String leaderId, short leaderPayloadVersion) 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 String
final void
postStop()
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.Methods inherited from class org.opendaylight.controller.cluster.raft.RaftActor
changeCurrentBehavior, getCurrentBehavior, getCurrentTerm, getId, getLeader, getLeaderId, getRaftActorContext, getRaftState, handleCommand, hasFollowers, isLeader, isLeaderActive, isLeadershipTransferInProgress, newRaftActorRecoverySupport, onVotingStateChangeComplete, persistData, persistence, preStart, setPeerAddress, setPersistence, setPersistence, snapshotSequenceNr, updateConfigParams
Methods inherited from class org.opendaylight.controller.cluster.common.actor.AbstractUntypedPersistentActor
createReceive, createReceiveRecover, executeInSelf, ignoreMessage, unknownMessage
Methods inherited from class akka.persistence.AbstractPersistentActor
akka$actor$StashSupport$_setter_$akka$actor$StashSupport$$capacity_$eq, akka$actor$StashSupport$_setter_$mailbox_$eq, akka$actor$StashSupport$$capacity, akka$actor$StashSupport$$theStash, akka$actor$StashSupport$$theStash_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$extension_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$instanceId_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$internalStash_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$maxMessageBatchSize_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$pendingInvocations_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$persistingEvents_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$processingCommands_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$unstashFilterPredicate_$eq, akka$persistence$Eventsourced$_setter_$akka$persistence$Eventsourced$$writerUuid_$eq, akka$persistence$Eventsourced$$_lastSequenceNr, akka$persistence$Eventsourced$$_lastSequenceNr_$eq, akka$persistence$Eventsourced$$currentState, akka$persistence$Eventsourced$$currentState_$eq, akka$persistence$Eventsourced$$eventBatch, akka$persistence$Eventsourced$$eventBatch_$eq, akka$persistence$Eventsourced$$extension, akka$persistence$Eventsourced$$instanceId, akka$persistence$Eventsourced$$internalStash, akka$persistence$Eventsourced$$journalBatch, akka$persistence$Eventsourced$$journalBatch_$eq, akka$persistence$Eventsourced$$maxMessageBatchSize, akka$persistence$Eventsourced$$pendingInvocations, akka$persistence$Eventsourced$$pendingStashingPersistInvocations, akka$persistence$Eventsourced$$pendingStashingPersistInvocations_$eq, akka$persistence$Eventsourced$$persistingEvents, akka$persistence$Eventsourced$$processingCommands, akka$persistence$Eventsourced$$sequenceNr, akka$persistence$Eventsourced$$sequenceNr_$eq, akka$persistence$Eventsourced$$unstashFilterPredicate, akka$persistence$Eventsourced$$writeInProgress, akka$persistence$Eventsourced$$writeInProgress_$eq, akka$persistence$Eventsourced$$writerUuid, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, clearStash, createStash, defer, deferAsync, deleteMessages, deleteSnapshot, deleteSnapshots, internalDefer, internalDeferAsync, internalDeleteMessagesBeforeSnapshot, internalPersist, internalPersistAll, internalPersistAllAsync, internalPersistAsync, internalStashOverflowStrategy, journal, lastSequenceNr, loadSnapshot, mailbox, onPersistFailure, onPersistRejected, onRecoveryFailure, onReplaySuccess, persist, persistAll, persistAllAsync, persistAsync, prepend, preRestart, receiveCommand, receiveRecover, recovery, recoveryFinished, recoveryRunning, saveSnapshot, snapshotPluginId, snapshotStore, snapshotterId, stash, unhandled, unstash, unstashAll, unstashAll
Methods inherited from class akka.actor.AbstractActor
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, emptyBehavior, getContext, getSelf, getSender, 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 akka.actor.Actor
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, postRestart, receive, self, sender, supervisorStrategy
Methods inherited from interface akka.persistence.Eventsourced
akka$persistence$Eventsourced$$changeState, akka$persistence$Eventsourced$$flushBatch, akka$persistence$Eventsourced$$flushJournalBatch, akka$persistence$Eventsourced$$log, akka$persistence$Eventsourced$$peekApplyHandler, akka$persistence$Eventsourced$$recovering, akka$persistence$Eventsourced$$setLastSequenceNr, akka$persistence$Eventsourced$$startRecovery, akka$persistence$Eventsourced$$stashInternally, akka$persistence$Eventsourced$$unstashInternally, akka$persistence$Eventsourced$$updateLastSequenceNr, akka$persistence$Eventsourced$$writeEventFailed, akka$persistence$Eventsourced$$writeEventRejected, akka$persistence$Eventsourced$$writeEventSucceeded
Methods inherited from interface akka.actor.StashSupport
context, self
-
Field Details
-
DEFAULT_NAME
- See Also:
-
NON_PERSISTENT_JOURNAL_ID
- See Also:
-
-
Method Details
-
postStop
-
handleRecover
- Overrides:
handleRecover
in classRaftActor
-
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
-
getRoleChangeNotifier
Description copied from class:RaftActor
Notifier Actor for this RaftActor to notify when a role change happens.- Specified by:
getRoleChangeNotifier
in classRaftActor
- Returns:
- ActorRef - ActorRef of the notifier or Optional.absent if none.
-
newLeaderStateChanged
protected final LeaderStateChanged newLeaderStateChanged(String memberId, String leaderId, short leaderPayloadVersion) - Overrides:
newLeaderStateChanged
in classRaftActor
-
isIsolatedLeader
protected boolean isIsolatedLeader() -
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
-
applyState
Description copied from class:RaftActor
The applyState method will be called by the RaftActor when some data needs to be applied to the actor's state.- Specified by:
applyState
in classRaftActor
- Parameters:
clientActor
- A reference to the client who sent this message. This is the same reference that was passed to persistData by the derived actor. clientActor may be null when the RaftActor is behaving as a follower or during recovery.identifier
- The identifier of the persisted data. This is also the same identifier that was passed to persistData by the derived actor. identifier may be null when the RaftActor is behaving as a follower or during recoverydata
- A piece of data that was persisted by the persistData call. This should NEVER be null.
-
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
-
persistenceId
-
journalPluginId
- Specified by:
journalPluginId
in interfacePersistenceIdentity
- Overrides:
journalPluginId
in classAbstractPersistentActor
-
builder
-