X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FRaftActorRecoveryCohort.java;h=1f9b93acd7e507f3f837f550697b1fde8eb67ee5;hp=a9f00aa80bcb93621d6f1ef3fadb4695dbe3b8c5;hb=73ab61a037dd2489600acbc1eaf6f9ee549c204a;hpb=f9a9cd1ea40d2477ccb16b03c71a87595226595a diff --git a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoveryCohort.java b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoveryCohort.java index a9f00aa80b..1f9b93acd7 100644 --- a/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoveryCohort.java +++ b/opendaylight/md-sal/sal-akka-raft/src/main/java/org/opendaylight/controller/cluster/raft/RaftActorRecoveryCohort.java @@ -7,6 +7,8 @@ */ package org.opendaylight.controller.cluster.raft; +import org.eclipse.jdt.annotation.Nullable; +import org.opendaylight.controller.cluster.raft.persisted.Snapshot; import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; /** @@ -19,6 +21,8 @@ public interface RaftActorRecoveryCohort { /** * This method is called during recovery at the start of a batch of state entries. Derived * classes should perform any initialization needed to start a batch. + * + * @param maxBatchSize the maximum batch size. */ void startLogRecoveryBatch(int maxBatchSize); @@ -33,13 +37,20 @@ public interface RaftActorRecoveryCohort { /** * This method is called during recovery to reconstruct the state of the actor. * - * @param snapshotBytes A snapshot of the state of the actor + * @param snapshotState A snapshot of the state of the actor */ - void applyRecoverySnapshot(byte[] snapshotBytes); + void applyRecoverySnapshot(Snapshot.State snapshotState); /** * This method is called during recovery at the end of a batch to apply the current batched * log entries. This method is called after {@link #appendRecoveredLogEntry}. */ void applyCurrentLogRecoveryBatch(); + + /** + * Returns the snapshot to restore from on recovery. + * + * @return the snapshot or null if there's no snapshot to restore + */ + @Nullable Snapshot getRestoreFromSnapshot(); }