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:
ForStIncrementalSnapshotStrategy
,ForStSnapshotStrategyBase
,RocksDBSnapshotStrategyBase
,RocksIncrementalSnapshotStrategy
,RocksNativeFullSnapshotStrategy
,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
.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
SnapshotStrategy.SnapshotResultSupplier<S extends StateObject>
A supplier for aSnapshotResult
with an access to aCloseableRegistry
for io tasks that need to be closed when cancelling the async part of the checkpoint.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description SnapshotStrategy.SnapshotResultSupplier<S>
asyncSnapshot(SR syncPartResource, long checkpointId, long timestamp, CheckpointStreamFactory streamFactory, CheckpointOptions checkpointOptions)
Operation that writes a snapshot into a stream that is provided by the givenCheckpointStreamFactory
and returns a @SupplierWithException
that gives a state handle to the snapshot.SR
syncPrepareResources(long checkpointId)
Performs the synchronous part of the snapshot.
-
-
-
Method Detail
-
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 givenCheckpointStreamFactory
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
.
-
-