X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=opendaylight%2Fmd-sal%2Fsal-akka-raft%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fcontroller%2Fcluster%2Fraft%2FRaftActorRecoveryCohort.java;h=f948769c9cf9f015200b5ce51d213b0296255240;hb=200164de7246237ee45f761c4db15b8b51f6a93c;hp=30e27e17fe4d483f872ae9e71dc6ae289b65cf83;hpb=11dadddb4d9ba26ae0b1795921c7a218a6d893c2;p=controller.git 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 30e27e17fe..f948769c9c 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,7 +7,9 @@ */ package org.opendaylight.controller.cluster.raft; +import javax.annotation.Nonnull; import javax.annotation.Nullable; +import org.opendaylight.controller.cluster.raft.persisted.Snapshot; import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload; /** @@ -20,6 +22,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); @@ -34,9 +38,9 @@ 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 @@ -45,10 +49,20 @@ public interface RaftActorRecoveryCohort { void applyCurrentLogRecoveryBatch(); /** - * Returns the state snapshot to restore from on recovery. + * Returns the snapshot to restore from on recovery. * - * @return the snapshot bytes or null if there's no snapshot to restore + * @return the snapshot or null if there's no snapshot to restore */ @Nullable - byte[] getRestoreFromSnapshot(); + Snapshot getRestoreFromSnapshot(); + + /** + * This method is called during recovery to de-serialize a snapshot that was persisted in the pre-Carbon format. + * + * @param from the snaphot bytes + * @return a Snapshot.State instance + */ + @Deprecated + @Nonnull + Snapshot.State deserializePreCarbonSnapshot(byte [] from); }