public class ExampleActor extends RaftActor implements RaftActorRecoveryCohort, RaftActorSnapshotCohort
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.StateLOG| Constructor and Description |
|---|
ExampleActor(String id,
Map<String,String> peerAddresses,
com.google.common.base.Optional<ConfigParams> configParams) |
| Modifier and Type | Method and Description |
|---|---|
void |
appendRecoveredLogEntry(Payload data)
This method is called during recovery to append state data to the current batch.
|
void |
applyCurrentLogRecoveryBatch()
This method is called during recovery at the end of a batch to apply the current batched
log entries.
|
void |
applyRecoverySnapshot(Snapshot.State snapshotState)
This method is called during recovery to reconstruct the state of the actor.
|
void |
applySnapshot(Snapshot.State snapshotState)
This method is called to apply a snapshot installed by the leader.
|
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.
|
com.google.common.base.Optional<akka.actor.ActorRef> |
createRoleChangeNotifier(String actorId) |
void |
createSnapshot(akka.actor.ActorRef actorRef,
Optional<OutputStream> installSnapshotStream)
This method is called by the RaftActor when a snapshot needs to be
created.
|
Snapshot.State |
deserializeSnapshot(com.google.common.io.ByteSource snapshotBytes)
This method is called to de-serialize snapshot data that was previously serialized via
RaftActorSnapshotCohort.createSnapshot(akka.actor.ActorRef, java.util.Optional<java.io.OutputStream>)
to a State instance. |
protected RaftActorRecoveryCohort |
getRaftActorRecoveryCohort()
Returns the RaftActorRecoveryCohort to participate in persistence recovery.
|
protected RaftActorSnapshotCohort |
getRaftActorSnapshotCohort()
Returns the RaftActorSnapshotCohort to participate in snapshot captures.
|
protected String |
getReplicatedLogState() |
Snapshot |
getRestoreFromSnapshot()
Returns the snapshot to restore from on recovery.
|
protected com.google.common.base.Optional<akka.actor.ActorRef> |
getRoleChangeNotifier()
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.
|
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.
|
String |
persistenceId() |
static akka.actor.Props |
props(String id,
Map<String,String> peerAddresses,
com.google.common.base.Optional<ConfigParams> configParams) |
void |
startLogRecoveryBatch(int maxBatchSize)
This method is called during recovery at the start of a batch of state entries.
|
changeCurrentBehavior, getCurrentBehavior, getCurrentTerm, getId, getLeader, getLeaderId, getRaftActorContext, getRaftState, handleCommand, handleRecover, hasFollowers, isLeader, isLeaderActive, isLeadershipTransferInProgress, newLeaderStateChanged, newOnDemandRaftStateBuilder, newRaftActorRecoverySupport, onLeaderChanged, onVotingStateChangeComplete, pauseLeader, persistData, persistence, postStop, preStart, setPeerAddress, setPersistence, setPersistence, snapshotSequenceNr, unpauseLeader, updateConfigParamsexecuteInSelf, ignoreMessage, onReceiveCommand, onReceiveRecover, unknownMessageakka$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, defer, deferAsync, deleteMessages, deleteSnapshot, deleteSnapshots, internalDefer, internalDeferAsync, internalDeleteMessagesBeforeSnapshot, 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, unstashAllakka$actor$Actor$_setter_$context_$eq, akka$actor$Actor$_setter_$self_$eq, context, getContext, getSelf, getSender, postRestart, receive, self, sender, supervisorStrategyclone, 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, akka$persistence$Eventsourced$$writeEventFailed, akka$persistence$Eventsourced$$writeEventRejected, akka$persistence$Eventsourced$$writeEventSucceededpublic ExampleActor(String id, Map<String,String> peerAddresses, com.google.common.base.Optional<ConfigParams> configParams)
public static akka.actor.Props props(String id, Map<String,String> peerAddresses, com.google.common.base.Optional<ConfigParams> configParams)
protected void handleNonRaftCommand(Object message)
RaftActorRaftActor.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 RaftActormessage - Incoming command messageprotected String getReplicatedLogState()
public com.google.common.base.Optional<akka.actor.ActorRef> createRoleChangeNotifier(String actorId)
protected com.google.common.base.Optional<akka.actor.ActorRef> getRoleChangeNotifier()
RaftActorgetRoleChangeNotifier in class RaftActorprotected void applyState(akka.actor.ActorRef clientActor,
org.opendaylight.yangtools.concepts.Identifier identifier,
Object data)
RaftActorapplyState in class RaftActorclientActor - 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.public void createSnapshot(akka.actor.ActorRef actorRef,
Optional<OutputStream> installSnapshotStream)
RaftActorSnapshotCohortcreateSnapshot in interface RaftActorSnapshotCohortactorRef - the actor to which to respondinstallSnapshotStream - Optional OutputStream that is present if the snapshot is to also be installed
on a follower. The implementation must serialize its state to the OutputStream and return the
installSnapshotStream instance in the CaptureSnapshotReply along with the snapshot State instance.
The snapshot State is serialized directly to the snapshot store while the OutputStream is used to send
the state data to follower(s) in chunks. The RaftActorSnapshotCohort.deserializeSnapshot(com.google.common.io.ByteSource) method is used to convert the
serialized data back to a State instance on the follower end. The serialization for snapshot install is
passed off so the cost of serialization is not charged to the raft actor's thread.public void applySnapshot(Snapshot.State snapshotState)
RaftActorSnapshotCohortapplySnapshot in interface RaftActorSnapshotCohortsnapshotState - a snapshot of the state of the actorprotected void onStateChanged()
RaftActoronStateChanged in class RaftActorpublic String persistenceId()
persistenceId in interface akka.persistence.PersistenceIdentityprotected RaftActorRecoveryCohort getRaftActorRecoveryCohort()
RaftActorgetRaftActorRecoveryCohort in class RaftActorpublic void startLogRecoveryBatch(int maxBatchSize)
RaftActorRecoveryCohortstartLogRecoveryBatch in interface RaftActorRecoveryCohortmaxBatchSize - the maximum batch size.public void appendRecoveredLogEntry(Payload data)
RaftActorRecoveryCohortRaftActorRecoveryCohort.startLogRecoveryBatch(int).appendRecoveredLogEntry in interface RaftActorRecoveryCohortdata - the state datapublic void applyCurrentLogRecoveryBatch()
RaftActorRecoveryCohortRaftActorRecoveryCohort.appendRecoveredLogEntry(org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload).applyCurrentLogRecoveryBatch in interface RaftActorRecoveryCohortpublic void onRecoveryComplete()
RaftActoronRecoveryComplete in class RaftActorpublic void applyRecoverySnapshot(Snapshot.State snapshotState)
RaftActorRecoveryCohortapplyRecoverySnapshot in interface RaftActorRecoveryCohortsnapshotState - A snapshot of the state of the actorprotected RaftActorSnapshotCohort getRaftActorSnapshotCohort()
RaftActorgetRaftActorSnapshotCohort in class RaftActorpublic Snapshot getRestoreFromSnapshot()
RaftActorRecoveryCohortgetRestoreFromSnapshot in interface RaftActorRecoveryCohortpublic Snapshot.State deserializeSnapshot(com.google.common.io.ByteSource snapshotBytes)
RaftActorSnapshotCohortRaftActorSnapshotCohort.createSnapshot(akka.actor.ActorRef, java.util.Optional<java.io.OutputStream>)
to a State instance.deserializeSnapshot in interface RaftActorSnapshotCohortsnapshotBytes - the ByteSource containing the serialized dataCopyright © 2019 OpenDaylight. All rights reserved.