2 * Copyright (c) 2025 PANTHEON.tech, s.r.o. 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
8 package org.opendaylight.controller.cluster.raft.spi;
10 import com.google.common.base.MoreObjects;
11 import java.io.IOException;
12 import java.util.function.Consumer;
13 import org.apache.pekko.persistence.JournalProtocol;
14 import org.apache.pekko.persistence.SnapshotProtocol;
15 import org.apache.pekko.persistence.SnapshotSelectionCriteria;
16 import org.eclipse.jdt.annotation.NonNullByDefault;
17 import org.eclipse.jdt.annotation.Nullable;
18 import org.opendaylight.controller.cluster.raft.persisted.Snapshot;
19 import org.opendaylight.raft.api.EntryInfo;
20 import org.opendaylight.raft.spi.InstallableSnapshot;
23 public abstract class ForwardingDataPersistenceProvider implements DataPersistenceProvider {
25 protected abstract DataPersistenceProvider delegate();
28 public boolean isRecoveryApplicable() {
29 return delegate().isRecoveryApplicable();
33 public @Nullable SnapshotFile lastSnapshot() throws IOException {
34 return delegate().lastSnapshot();
38 public <T> void persist(final T entry, final Consumer<T> callback) {
39 delegate().persist(entry, callback);
43 public <T> void persistAsync(final T entry, final Consumer<T> callback) {
44 delegate().persistAsync(entry, callback);
48 public void saveSnapshot(final Snapshot entry) {
49 delegate().saveSnapshot(entry);
53 public <T extends StateSnapshot> void streamToInstall(final EntryInfo lastIncluded, final T snapshot,
54 final StateSnapshot.Writer<T> writer, final Callback<InstallableSnapshot> callback) {
55 delegate().streamToInstall(lastIncluded, snapshot, writer, callback);
59 public void deleteSnapshots(final SnapshotSelectionCriteria criteria) {
60 delegate().deleteSnapshots(criteria);
64 public void deleteMessages(final long sequenceNumber) {
65 delegate().deleteMessages(sequenceNumber);
69 public long getLastSequenceNumber() {
70 return delegate().getLastSequenceNumber();
74 public boolean handleJournalResponse(final JournalProtocol.Response response) {
75 return delegate().handleJournalResponse(response);
79 public boolean handleSnapshotResponse(final SnapshotProtocol.Response response) {
80 return delegate().handleSnapshotResponse(response);
84 public final String toString() {
85 return MoreObjects.toStringHelper(this).add("delegate", delegate()).toString();