Package io.camunda.zeebe.snapshots
Interface PersistedSnapshotStore
- All Superinterfaces:
AutoCloseable,CloseableSilently
- All Known Subinterfaces:
ConstructableSnapshotStore,ReceivableSnapshotStore
- All Known Implementing Classes:
FileBasedSnapshotStore
Represents a store, which allows to persist snapshots on a storage, which is implementation
dependent. It can receive
SnapshotChunk's from an already PersistedSnapshot and
persist them in this current store.
Only one PersistedSnapshot at a time is stored in the PersistedSnapshotStore
and can be received via getLatestSnapshot().
-
Method Summary
Modifier and TypeMethodDescriptionaddSnapshotListener(PersistedSnapshotListener listener) Adds anPersistedSnapshotListenerto the store, which is notified when a newPersistedSnapshotis persisted at this store.delete()Deletes aPersistedSnapshotStorefrom disk.Returns a set of all available snapshots.Returns the lowest compaction bound of all available snapshots.longgetPath()booleanhasSnapshotId(String id) Returns true if the given identifier is equal to the snapshot id of the current persisted snapshot, false otherwise.Purges all ongoing pending/transient/volatile snapshots.Removes an registeredPersistedSnapshotListenerfrom the store.Methods inherited from interface io.camunda.zeebe.util.CloseableSilently
close
-
Method Details
-
hasSnapshotId
Returns true if the given identifier is equal to the snapshot id of the current persisted snapshot, false otherwise.- Parameters:
id- the snapshot Id to look for- Returns:
- true if the current snapshot has the equal Id, false otherwise
- See Also:
-
getLatestSnapshot
Optional<PersistedSnapshot> getLatestSnapshot()- Returns:
- the latest
PersistedSnapshotif exists
-
getAvailableSnapshots
ActorFuture<Set<PersistedSnapshot>> getAvailableSnapshots()Returns a set of all available snapshots. -
getCompactionBound
ActorFuture<Long> getCompactionBound()Returns the lowest compaction bound of all available snapshots. -
purgePendingSnapshots
ActorFuture<Void> purgePendingSnapshots()Purges all ongoing pending/transient/volatile snapshots.- Returns:
- future which will be completed when all pending snapshots are deleted
-
addSnapshotListener
Adds anPersistedSnapshotListenerto the store, which is notified when a newPersistedSnapshotis persisted at this store.- Parameters:
listener- the listener which should be added and notified later
-
removeSnapshotListener
Removes an registeredPersistedSnapshotListenerfrom the store. The listener will no longer called when a newPersistedSnapshotis persisted at this store.- Parameters:
listener- the listener which should be removed
-
getCurrentSnapshotIndex
long getCurrentSnapshotIndex()- Returns:
- the snapshot index of the latest
PersistedSnapshot - See Also:
-
delete
ActorFuture<Void> delete()Deletes aPersistedSnapshotStorefrom disk.The snapshot store will be deleted by simply reading
snapshotfile names from disk and deleting snapshot files directly. Deleting the snapshot store does not involve reading any snapshot files into memory. -
getPath
Path getPath()
-