Merge "Bug 2358: Fixed warnings in Restconf"
[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 org.opendaylight.controller.cluster.raft.protobuff.client.messages.Payload;
11
12 /**
13  * Interface for a class that participates in raft actor persistence recovery.
14  *
15  * @author Thomas Pantelis
16  */
17 public interface RaftActorRecoveryCohort {
18
19     /**
20      * This method is called during recovery at the start of a batch of state entries. Derived
21      * classes should perform any initialization needed to start a batch.
22      */
23     void startLogRecoveryBatch(int maxBatchSize);
24
25     /**
26      * This method is called during recovery to append state data to the current batch. This method
27      * is called 1 or more times after {@link #startLogRecoveryBatch}.
28      *
29      * @param data the state data
30      */
31     void appendRecoveredLogEntry(Payload data);
32
33     /**
34      * This method is called during recovery to reconstruct the state of the actor.
35      *
36      * @param snapshotBytes A snapshot of the state of the actor
37      */
38     void applyRecoverySnapshot(byte[] snapshotBytes);
39
40     /**
41      * This method is called during recovery at the end of a batch to apply the current batched
42      * log entries. This method is called after {@link #appendRecoveredLogEntry}.
43      */
44     void applyCurrentLogRecoveryBatch();
45 }