Package org.apache.flink.runtime.state
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
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.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA supplier for aSnapshotResultwith an access to aCloseableRegistryfor io tasks that need to be closed when cancelling the async part of the checkpoint. -
Method Summary
Modifier and TypeMethodDescriptionasyncSnapshot(SR syncPartResource, long checkpointId, long timestamp, CheckpointStreamFactory streamFactory, CheckpointOptions checkpointOptions) Operation that writes a snapshot into a stream that is provided by the givenCheckpointStreamFactoryand returns a @SupplierWithExceptionthat gives a state handle to the snapshot.syncPrepareResources(long checkpointId) Performs the synchronous part of the snapshot.
-
Method Details
-
syncPrepareResources
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 givenCheckpointStreamFactoryand returns a @SupplierWithExceptionthat 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.
-