Bug 7180 - error-severity and error-type values should be lowercase
[controller.git] / opendaylight / md-sal / sal-clustering-commons / src / main / java / org / opendaylight / controller / cluster / DataPersistenceProvider.java
1 /*
2  * Copyright (c) 2014 Cisco 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
9 package org.opendaylight.controller.cluster;
10
11 import akka.japi.Procedure;
12 import akka.persistence.SnapshotSelectionCriteria;
13
14 /**
15  * DataPersistenceProvider provides methods to persist data and is an abstraction of the akka-persistence persistence
16  * API.
17  */
18 public interface DataPersistenceProvider {
19
20     /**
21      * Returns whether or not persistence recovery is applicable/enabled.
22      *
23      * @return true if recovery is applicable, otherwise false, in which case the provider is not persistent and may
24      *         not have anything to be recovered
25      */
26     boolean isRecoveryApplicable();
27
28     /**
29      * Persists an entry to he applicable synchronously.
30      *
31      * @param entry the journal entry to persist
32      * @param procedure the callback when persistence is complete
33      * @param <T> the type of the journal entry
34      */
35     <T> void persist(T entry, Procedure<T> procedure);
36
37     /**
38      * Saves a snapshot.
39      *
40      * @param snapshot the snapshot object to save
41      */
42     void saveSnapshot(Object snapshot);
43
44     /**
45      * Deletes snapshots based on the given criteria.
46      *
47      * @param criteria the search criteria
48      */
49     void deleteSnapshots(SnapshotSelectionCriteria criteria);
50
51     /**
52      * Deletes journal entries up to the given sequence number.
53      *
54      * @param sequenceNumber the sequence number
55      */
56     void deleteMessages(long sequenceNumber);
57
58     /**
59      * Returns the last sequence number contained in the journal.
60      *
61      * @return the last sequence number
62      */
63     long getLastSequenceNumber();
64 }