Remove unneeded SuppressWarnings
[controller.git] / opendaylight / md-sal / sal-akka-raft / src / main / java / org / opendaylight / controller / cluster / raft / RaftActorRecoveryCohort.java
1 /*
2  * Copyright (c) 2015 Brocade Communications Systems, Inc. and others.  All rights reserved.
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6  * and is available at http://www.eclipse.org/legal/epl-v10.html
7  */
8 package org.opendaylight.controller.cluster.raft;
9
10 import javax.annotation.Nonnull;
11 import javax.annotation.Nullable;
12 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
13 import org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
14
15 /**
16  * Interface for a class that participates in raft actor persistence recovery.
17  *
18  * @author Thomas Pantelis
19  */
20 public interface RaftActorRecoveryCohort {
21
22     /**
23      * This method is called during recovery at the start of a batch of state entries. Derived
24      * classes should perform any initialization needed to start a batch.
25      *
26      * @param maxBatchSize the maximum batch size.
27      */
28     void startLogRecoveryBatch(int maxBatchSize);
29
30     /**
31      * This method is called during recovery to append state data to the current batch. This method
32      * is called 1 or more times after {@link #startLogRecoveryBatch}.
33      *
34      * @param data the state data
35      */
36     void appendRecoveredLogEntry(Payload data);
37
38     /**
39      * This method is called during recovery to reconstruct the state of the actor.
40      *
41      * @param snapshotState A snapshot of the state of the actor
42      */
43     void applyRecoverySnapshot(Snapshot.State snapshotState);
44
45     /**
46      * This method is called during recovery at the end of a batch to apply the current batched
47      * log entries. This method is called after {@link #appendRecoveredLogEntry}.
48      */
49     void applyCurrentLogRecoveryBatch();
50
51     /**
52      * Returns the snapshot to restore from on recovery.
53      *
54      * @return the snapshot or null if there's no snapshot to restore
55      */
56     @Nullable
57     Snapshot getRestoreFromSnapshot();
58
59     /**
60      * This method is called during recovery to de-serialize a snapshot that was persisted in the pre-Carbon format.
61      *
62      * @param from the snaphot bytes
63      * @return a Snapshot.State instance
64      */
65     @Deprecated
66     @Nonnull
67     Snapshot.State deserializePreCarbonSnapshot(byte [] from);
68 }