Interface SnapshotStore
- All Known Implementing Classes:
DisabledRaftStorage
,EnabledRaftStorage
,ForwardingSnapshotStore
,RaftStorage
@NonNullByDefault
public interface SnapshotStore
Interface to a access and manage
SnapshotFile
s.-
Method Summary
Modifier and TypeMethodDescription@Nullable SnapshotFile
Returns the last available snapshot.void
saveSnapshot
(RaftSnapshot raftSnapshot, EntryInfo lastIncluded, @Nullable StateSnapshot.ToStorage<?> snapshot, Instant timestamp) Saves a snapshot synchronously and delete any previous snapshots.void
saveSnapshot
(RaftSnapshot raftSnapshot, EntryInfo lastIncluded, @Nullable StateSnapshot.ToStorage<?> snapshot, RaftCallback<Instant> callback) Saves a snapshot asynchronously and delete any previous snapshots.void
streamToInstall
(EntryInfo lastIncluded, StateSnapshot.ToStorage<?> snapshot, RaftCallback<InstallableSnapshot> callback) Serialize aStateSnapshot.ToStorage
snapshot and make the result available as anInstallableSnapshot
to 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.ToStorage
snapshot and make the result available as anInstallableSnapshot
to 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, ornull
if 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
- theRaftSnapshot
lastIncluded
- last included index/termsnapshot
- the snapshot, ornull
if not applicabletimestamp
- snapshot timestamp- Throws:
IOException
- when an I/O error occurs
-