2 * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved.
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
9 package org.opendaylight.controller.cluster;
11 import akka.japi.Procedure;
12 import akka.persistence.SnapshotSelectionCriteria;
15 * DataPersistenceProvider provides methods to persist data and is an abstraction of the akka-persistence persistence
18 public interface DataPersistenceProvider {
21 * Returns whether or not persistence recovery is applicable/enabled.
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
26 boolean isRecoveryApplicable();
29 * Persists an entry to he applicable synchronously.
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
35 <T> void persist(T entry, Procedure<T> procedure);
40 * @param snapshot the snapshot object to save
42 void saveSnapshot(Object snapshot);
45 * Deletes snapshots based on the given criteria.
47 * @param criteria the search criteria
49 void deleteSnapshots(SnapshotSelectionCriteria criteria);
52 * Deletes journal entries up to the given sequence number.
54 * @param sequenceNumber the sequence number
56 void deleteMessages(long sequenceNumber);
59 * Returns the last sequence number contained in the journal.
61 * @return the last sequence number
63 long getLastSequenceNumber();