public class Shard extends RaftActor
Our Shard uses InMemoryDataTree as it's internal representation and delegates all requests it
Modifier and Type | Class and Description |
---|---|
static class |
Shard.AbstractBuilder<T extends Shard.AbstractBuilder<T,S>,S extends Shard> |
static class |
Shard.Builder |
akka.persistence.Eventsourced.AsyncHandlerInvocation, akka.persistence.Eventsourced.AsyncHandlerInvocation$, akka.persistence.Eventsourced.PendingHandlerInvocation, akka.persistence.Eventsourced.ProcessingState, akka.persistence.Eventsourced.RecoveryTick, akka.persistence.Eventsourced.RecoveryTick$, akka.persistence.Eventsourced.StashingHandlerInvocation, akka.persistence.Eventsourced.StashingHandlerInvocation$, akka.persistence.Eventsourced.State
Modifier and Type | Field and Description |
---|---|
static String |
DEFAULT_NAME |
LOG
Modifier | Constructor and Description |
---|---|
protected |
Shard(Shard.AbstractBuilder<?,?> builder) |
Modifier and Type | Method and Description |
---|---|
protected void |
applyState(akka.actor.ActorRef clientActor,
org.opendaylight.yangtools.concepts.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() |
Collection<?> |
convertPendingTransactionsToMessages()
Clears all pending transactions and converts them to messages to be forwarded to a new leader.
|
int |
getCohortCacheSize() |
ShardDataTree |
getDataStore() |
DatastoreContext |
getDatastoreContext() |
int |
getPendingTxCommitQueueSize() |
protected RaftActorRecoveryCohort |
getRaftActorRecoveryCohort()
Returns the RaftActorRecoveryCohort to participate in persistence recovery.
|
RaftActorSnapshotCohort |
getRaftActorSnapshotCohort()
Returns the RaftActorSnapshotCohort to participate in snapshot captures.
|
protected com.google.common.base.Optional<akka.actor.ActorRef> |
getRoleChangeNotifier()
Notifier Actor for this RaftActor to notify when a role change happens.
|
protected void |
handleBatchedModificationsLocal(BatchedModifications batched,
akka.actor.ActorRef sender) |
protected void |
handleNonRaftCommand(Object message)
Method exposed for subclasses to plug-in their logic.
|
protected void |
handleRecover(Object message) |
protected boolean |
isIsolatedLeader() |
protected LeaderStateChanged |
newLeaderStateChanged(String memberId,
String leaderId,
short leaderPayloadVersion) |
protected OnDemandRaftState.AbstractBuilder<?,?> |
newOnDemandRaftStateBuilder() |
protected void |
onDatastoreContext(DatastoreContext context) |
protected void |
onLeaderChanged(String oldLeader,
String newLeader) |
protected void |
onRecoveryComplete()
This method is called when recovery is complete.
|
protected void |
onStateChanged()
This method will be called by the RaftActor when the state of the
RaftActor changes.
|
protected 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.
|
String |
persistenceId() |
void |
postStop() |
protected void |
unpauseLeader()
This method is invoked when the actions hooked to the leader becoming paused failed to execute and the leader
should resume normal operations.
|
changeCurrentBehavior, getCurrentBehavior, getCurrentTerm, getId, getLeader, getLeaderId, getRaftActorContext, getRaftState, handleCommand, hasFollowers, isLeader, isLeaderActive, isLeadershipTransferInProgress, newRaftActorRecoverySupport, onVotingStateChangeComplete, persistData, persistence, preStart, setPeerAddress, setPersistence, setPersistence, snapshotSequenceNr, updateConfigParams
executeInSelf, ignoreMessage, onReceiveCommand, onReceiveRecover, unknownMessage
akka$actor$StashSupport$_setter_$akka$actor$StashSupport$$capacity_$eq, akka$actor$StashSupport$_setter_$mailbox_$eq, akka$actor$StashSupport$$capacity, akka$actor$StashSupport$$theStash_$eq, akka$actor$StashSupport$$theStash, 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_$eq, akka$persistence$Eventsourced$$_lastSequenceNr, akka$persistence$Eventsourced$$currentState_$eq, akka$persistence$Eventsourced$$currentState, akka$persistence$Eventsourced$$eventBatch_$eq, akka$persistence$Eventsourced$$eventBatch, akka$persistence$Eventsourced$$extension, akka$persistence$Eventsourced$$instanceId, akka$persistence$Eventsourced$$internalStash, akka$persistence$Eventsourced$$journalBatch_$eq, akka$persistence$Eventsourced$$journalBatch, akka$persistence$Eventsourced$$maxMessageBatchSize, akka$persistence$Eventsourced$$pendingInvocations, akka$persistence$Eventsourced$$pendingStashingPersistInvocations_$eq, akka$persistence$Eventsourced$$pendingStashingPersistInvocations, akka$persistence$Eventsourced$$persistingEvents, akka$persistence$Eventsourced$$processingCommands, akka$persistence$Eventsourced$$sequenceNr_$eq, akka$persistence$Eventsourced$$sequenceNr, akka$persistence$Eventsourced$$unstashFilterPredicate, akka$persistence$Eventsourced$$writeInProgress_$eq, akka$persistence$Eventsourced$$writeInProgress, akka$persistence$Eventsourced$$writerUuid, aroundPostRestart, aroundPostStop, aroundPreRestart, aroundPreStart, aroundReceive, clearStash, createStash, deferAsync, deleteMessages, deleteSnapshot, deleteSnapshots, internalDeferAsync, internalPersist, internalPersistAll, internalPersistAllAsync, internalPersistAsync, internalStashOverflowStrategy, journal, journalPluginId, lastSequenceNr, loadSnapshot, mailbox, onPersistFailure, onPersistRejected, onReceive, onRecoveryFailure, onReplaySuccess, persist, persistAll, persistAllAsync, persistAsync, prepend, preRestart, receiveCommand, receiveRecover, recovery, recoveryFinished, recoveryRunning, saveSnapshot, snapshotPluginId, snapshotStore, snapshotterId, stash, unhandled, unstash, unstashAll, unstashAll
akka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, getContext, getSelf, getSender, postRestart, receive, self, sender, supervisorStrategy
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
$init$, akka$persistence$Eventsourced$$changeState, akka$persistence$Eventsourced$$flushBatch, akka$persistence$Eventsourced$$flushJournalBatch, 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
public static final String DEFAULT_NAME
protected Shard(Shard.AbstractBuilder<?,?> builder)
public void postStop()
protected void handleRecover(Object message)
handleRecover
in class RaftActor
protected void handleNonRaftCommand(Object message)
RaftActor
RaftActor.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 handlehandleNonRaftCommand
in class RaftActor
message
- Incoming command messagepublic int getPendingTxCommitQueueSize()
public int getCohortCacheSize()
protected com.google.common.base.Optional<akka.actor.ActorRef> getRoleChangeNotifier()
RaftActor
getRoleChangeNotifier
in class RaftActor
protected LeaderStateChanged newLeaderStateChanged(String memberId, String leaderId, short leaderPayloadVersion)
newLeaderStateChanged
in class RaftActor
protected void onDatastoreContext(DatastoreContext context)
protected void handleBatchedModificationsLocal(BatchedModifications batched, akka.actor.ActorRef sender)
protected boolean isIsolatedLeader()
public RaftActorSnapshotCohort getRaftActorSnapshotCohort()
RaftActor
getRaftActorSnapshotCohort
in class RaftActor
@Nonnull protected RaftActorRecoveryCohort getRaftActorRecoveryCohort()
RaftActor
getRaftActorRecoveryCohort
in class RaftActor
protected void onRecoveryComplete()
RaftActor
onRecoveryComplete
in class RaftActor
protected void applyState(akka.actor.ActorRef clientActor, org.opendaylight.yangtools.concepts.Identifier identifier, Object data)
RaftActor
applyState
in class RaftActor
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.protected void onStateChanged()
RaftActor
onStateChanged
in class RaftActor
protected void onLeaderChanged(String oldLeader, String newLeader)
onLeaderChanged
in class RaftActor
public Collection<?> convertPendingTransactionsToMessages()
protected void pauseLeader(Runnable operation)
RaftActor
The default implementation immediately runs the operation.
pauseLeader
in class RaftActor
operation
- the operation to runprotected void unpauseLeader()
RaftActor
Note this method can be invoked even before the operation supplied to RaftActor.pauseLeader(Runnable)
is invoked.
unpauseLeader
in class RaftActor
protected OnDemandRaftState.AbstractBuilder<?,?> newOnDemandRaftStateBuilder()
newOnDemandRaftStateBuilder
in class RaftActor
public String persistenceId()
public DatastoreContext getDatastoreContext()
public ShardDataTree getDataStore()
public static Shard.Builder builder()
Copyright © 2019 OpenDaylight. All rights reserved.