Interface PersistedSnapshotStore

All Superinterfaces:
AutoCloseable, CloseableSilently
All Known Subinterfaces:
ConstructableSnapshotStore, ReceivableSnapshotStore
All Known Implementing Classes:
FileBasedSnapshotStore

public interface PersistedSnapshotStore extends CloseableSilently
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 Details

    • hasSnapshotId

      boolean hasSnapshotId(String id)
      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 PersistedSnapshot if exists
    • getAvailableSnapshots

      ActorFuture<Set<PersistedSnapshot>> getAvailableSnapshots()
      Returns a set of all available snapshots.
      Returns:
    • purgePendingSnapshots

      ActorFuture<Void> purgePendingSnapshots()
      Purges all ongoing pending/transient/volatile snapshots.
      Returns:
      future which will be completed when all pending snapshots are deleted
    • addSnapshotListener

      ActorFuture<Boolean> addSnapshotListener(PersistedSnapshotListener listener)
      Adds an PersistedSnapshotListener to the store, which is notified when a new PersistedSnapshot is persisted at this store.
      Parameters:
      listener - the listener which should be added and notified later
      Returns:
    • removeSnapshotListener

      ActorFuture<Boolean> removeSnapshotListener(PersistedSnapshotListener listener)
      Removes an registered PersistedSnapshotListener from the store. The listener will no longer called when a new PersistedSnapshot is persisted at this store.
      Parameters:
      listener - the listener which should be removed
      Returns:
    • getCurrentSnapshotIndex

      long getCurrentSnapshotIndex()
      Returns:
      the snapshot index of the latest PersistedSnapshot
      See Also:
    • delete

      ActorFuture<Void> delete()
      Deletes a PersistedSnapshotStore from disk.

      The snapshot store will be deleted by simply reading snapshot file names from disk and deleting snapshot files directly. Deleting the snapshot store does not involve reading any snapshot files into memory.

      Returns:
    • getPath

      Path getPath()
    • copySnapshot

      ActorFuture<Void> copySnapshot(PersistedSnapshot snapshot, Path targetDirectory)
      Copy snapshot to the given directory
      Parameters:
      snapshot - the snapshot to be copied
      targetDirectory - the directory to which the snapshot files will be copied
      Returns:
      future which will be completed exceptionally if the snapshot was not copied successfully