Class NoopRaftActorSnapshotCohort
- java.lang.Object
-
- org.opendaylight.controller.cluster.raft.NoopRaftActorSnapshotCohort
-
- All Implemented Interfaces:
RaftActorSnapshotCohort
public final class NoopRaftActorSnapshotCohort extends Object implements RaftActorSnapshotCohort
RaftActorSnapshotCohort implementation that does nothing.- Author:
- Thomas Pantelis
-
-
Field Summary
Fields Modifier and Type Field Description static NoopRaftActorSnapshotCohort
INSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applySnapshot(Snapshot.State snapshotState)
This method is called to apply a snapshot installed by the leader.void
createSnapshot(ActorRef actorRef, Optional<OutputStream> installSnapshotStream)
This method is called by the RaftActor when a snapshot needs to be created.Snapshot.State
deserializeSnapshot(ByteSource snapshotBytes)
This method is called to de-serialize snapshot data that was previously serialized viaRaftActorSnapshotCohort.createSnapshot(akka.actor.ActorRef, java.util.Optional<java.io.OutputStream>)
to a State instance.
-
-
-
Field Detail
-
INSTANCE
public static final NoopRaftActorSnapshotCohort INSTANCE
-
-
Method Detail
-
createSnapshot
public void createSnapshot(ActorRef actorRef, Optional<OutputStream> installSnapshotStream)
Description copied from interface:RaftActorSnapshotCohort
This method is called by the RaftActor when a snapshot needs to be created. The implementation should send a CaptureSnapshotReply to the given actor.- Specified by:
createSnapshot
in interfaceRaftActorSnapshotCohort
- Parameters:
actorRef
- 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. TheRaftActorSnapshotCohort.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.
-
applySnapshot
public void applySnapshot(Snapshot.State snapshotState)
Description copied from interface:RaftActorSnapshotCohort
This method is called to apply a snapshot installed by the leader.- Specified by:
applySnapshot
in interfaceRaftActorSnapshotCohort
- Parameters:
snapshotState
- a snapshot of the state of the actor
-
deserializeSnapshot
public Snapshot.State deserializeSnapshot(ByteSource snapshotBytes)
Description copied from interface:RaftActorSnapshotCohort
This method is called to de-serialize snapshot data that was previously serialized viaRaftActorSnapshotCohort.createSnapshot(akka.actor.ActorRef, java.util.Optional<java.io.OutputStream>)
to a State instance.- Specified by:
deserializeSnapshot
in interfaceRaftActorSnapshotCohort
- Parameters:
snapshotBytes
- the ByteSource containing the serialized data- Returns:
- the converted snapshot State
-
-