Interface SnapshotStore
- All Known Implementing Classes:
DisabledRaftStorage,EnabledRaftStorage,ForwardingSnapshotStore,RaftStorage
@NonNullByDefault
public interface SnapshotStore
Interface to a access and manage
SnapshotFiles.-
Method Summary
Modifier and TypeMethodDescription@Nullable SnapshotFileReturns the last available snapshot.voidsaveSnapshot(RaftSnapshot raftSnapshot, EntryInfo lastIncluded, @Nullable StateSnapshot.ToStorage<?> snapshot, Instant timestamp) Saves a snapshot synchronously and delete any previous snapshots.voidsaveSnapshot(RaftSnapshot raftSnapshot, EntryInfo lastIncluded, @Nullable StateSnapshot.ToStorage<?> snapshot, RaftCallback<Instant> callback) Saves a snapshot asynchronously and delete any previous snapshots.voidstreamToInstall(EntryInfo lastIncluded, StateSnapshot.ToStorage<?> snapshot, RaftCallback<InstallableSnapshot> callback) Serialize aStateSnapshot.ToStoragesnapshot and make the result available as anInstallableSnapshotto the specified callback.
-
Method Details
-
lastSnapshot
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 aStateSnapshot.ToStoragesnapshot and make the result available as anInstallableSnapshotto the specified callback.- Parameters:
lastIncluded- last included index/termsnapshot- the snapshotcallback- 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- theRaftSnapshot, receiving the snapshot timestamplastIncluded- last included index/termsnapshot- the snapshot, ornullif not applicablecallback- 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- theRaftSnapshotlastIncluded- last included index/termsnapshot- the snapshot, ornullif not applicabletimestamp- snapshot timestamp- Throws:
IOException- when an I/O error occurs
-