Interface SnapshotStrategy<S extends StateObject,SR extends SnapshotResources>

Type Parameters:
S - type of the returned state object that represents the result of the snapshot operation.
SR - type of produced resources in the synchronous part.
All Known Implementing Classes:
SavepointSnapshotStrategy

@Internal public interface SnapshotStrategy<S extends StateObject,SR extends SnapshotResources>
Interface for different snapshot approaches in state backends. Implementing classes should ideally be stateless or at least threadsafe, it can be called in parallel by multiple checkpoints.

The interface can be later on executed in a synchronous or asynchronous manner. See SnapshotStrategyRunner.

  • Method Details

    • syncPrepareResources

      SR syncPrepareResources(long checkpointId) throws Exception
      Performs the synchronous part of the snapshot. It returns resources which can be later on used in the asynchronous part.
      Parameters:
      checkpointId - The ID of the checkpoint.
      Returns:
      Resources needed to finish the snapshot.
      Throws:
      Exception
    • asyncSnapshot

      SnapshotStrategy.SnapshotResultSupplier<S> asyncSnapshot(SR syncPartResource, long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory streamFactory, @Nonnull CheckpointOptions checkpointOptions)
      Operation that writes a snapshot into a stream that is provided by the given CheckpointStreamFactory and returns a @SupplierWithException that gives a state handle to the snapshot.
      Parameters:
      checkpointId - The ID of the checkpoint.
      timestamp - The timestamp of the checkpoint.
      streamFactory - The factory that we can use for writing our state to streams.
      checkpointOptions - Options for how to perform this checkpoint.
      Returns:
      A supplier that will yield a StateObject.