Interface SnapshotStore

All Known Implementing Classes:
DisabledRaftStorage, EnabledRaftStorage, ForwardingSnapshotStore, RaftStorage

@NonNullByDefault public interface SnapshotStore
Interface to a access and manage SnapshotFiles.
  • Method Details

    • lastSnapshot

      @Nullable SnapshotFile lastSnapshot() throws IOException
      Returns the last available snapshot.
      Returns:
      the last available snapshot
      Throws:
      IOException - if an I/O error occurs
    • streamToInstall

      void streamToInstall(EntryInfo lastIncluded, StateSnapshot.ToStorage<?> snapshot, RaftCallback<InstallableSnapshot> callback)
      Serialize a StateSnapshot.ToStorage snapshot and make the result available as an InstallableSnapshot to the specified callback.
      Parameters:
      lastIncluded - last included index/term
      snapshot - the snapshot
      callback - the callback to invoke
    • saveSnapshot

      void saveSnapshot(RaftSnapshot raftSnapshot, EntryInfo lastIncluded, @Nullable StateSnapshot.ToStorage<?> snapshot, RaftCallback<Instant> callback)
      Saves a snapshot asynchronously and delete any previous snapshots.
      Parameters:
      raftSnapshot - the RaftSnapshot, receiving the snapshot timestamp
      lastIncluded - last included index/term
      snapshot - the snapshot, or null if not applicable
      callback - the callback to invoke
    • saveSnapshot

      void saveSnapshot(RaftSnapshot raftSnapshot, EntryInfo lastIncluded, @Nullable StateSnapshot.ToStorage<?> snapshot, Instant timestamp) throws IOException
      Saves a snapshot synchronously and delete any previous snapshots. This method should only be called during recovery.
      Parameters:
      raftSnapshot - the RaftSnapshot
      lastIncluded - last included index/term
      snapshot - the snapshot, or null if not applicable
      timestamp - snapshot timestamp
      Throws:
      IOException - when an I/O error occurs