Class FileBasedTransientSnapshot

java.lang.Object
io.camunda.zeebe.snapshots.impl.FileBasedTransientSnapshot
All Implemented Interfaces:
PersistableSnapshot, TransientSnapshot

public final class FileBasedTransientSnapshot extends Object implements TransientSnapshot
Represents a pending snapshot, that is a snapshot in the process of being written and has not yet been committed to the store.
  • Method Details

    • take

      public ActorFuture<Void> take(Consumer<Path> takeSnapshot)
      Description copied from interface: TransientSnapshot
      Takes a snapshot on the given path. This can be persisted later via calling PersistableSnapshot.persist(). Based on the implementation this could mean that this is written before on a temporary folder and then moved to the valid snapshot directory.
      Specified by:
      take in interface TransientSnapshot
      Parameters:
      takeSnapshot - the predicate which should take the snapshot and should return true on success
      Returns:
      a future reflecting the result of the operation
    • withLastFollowupEventPosition

      public TransientSnapshot withLastFollowupEventPosition(long lastFollowupEventPosition)
      Description copied from interface: TransientSnapshot
      A snapshot is only valid if the accompanying logstream has events from processedPosition up to the last followup event position. The last followUp event position is the position of an event whose source position >= actual processed position in the state.
      Specified by:
      withLastFollowupEventPosition in interface TransientSnapshot
      Parameters:
      lastFollowupEventPosition - position of the followup event which must be in the logstream to ensure that the system can recover from the snapshot and the events in the logstream.
      Returns:
      transient snapshot.
    • abort

      public ActorFuture<Void> abort()
      Description copied from interface: PersistableSnapshot
      Aborts the not yet persisted snapshot and removes all related data.
      Specified by:
      abort in interface PersistableSnapshot
      Returns:
      a future which will be completed when the abort is done.
    • persist

      public ActorFuture<PersistedSnapshot> persist()
      Description copied from interface: PersistableSnapshot
      Persists the snapshot with all his data and returns the representation of this snapshot.
      Specified by:
      persist in interface PersistableSnapshot
      Returns:
      a future that will be completed with the persisted snapshot
    • snapshotId

      public SnapshotId snapshotId()
      Specified by:
      snapshotId in interface PersistableSnapshot
      Returns:
      the snapshotId of the snapshot
    • getPath

      public Path getPath()
      Description copied from interface: PersistableSnapshot
      Returns the pending snapshot's path.
      Specified by:
      getPath in interface PersistableSnapshot
      Returns:
      the path of the pending snapshot
    • toString

      public String toString()
      Overrides:
      toString in class Object