Package org.apache.flink.runtime.state
Interface AsyncKeyedStateBackend<K>
-
- All Superinterfaces:
AsyncExecutionController.SwitchContextListener<K>
,AutoCloseable
,CheckpointListener
,Closeable
,Disposable
,InternalCheckpointListener
,PriorityQueueSetFactory
,Snapshotable<SnapshotResult<KeyedStateHandle>>
- All Known Implementing Classes:
AsyncKeyedStateBackendAdaptor
,ForStKeyedStateBackend
@Internal public interface AsyncKeyedStateBackend<K> extends Snapshotable<SnapshotResult<KeyedStateHandle>>, InternalCheckpointListener, PriorityQueueSetFactory, Disposable, Closeable, AsyncExecutionController.SwitchContextListener<K>
An async keyed state backend provides methods supporting to access keyed state asynchronously and in batch.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description <N,S extends State,SV>
ScreateState(N defaultNamespace, TypeSerializer<N> namespaceSerializer, StateDescriptor<SV> stateDesc)
Creates and returns a new state.StateExecutor
createStateExecutor()
Creates aStateExecutor
which supports to execute a batch of state requests asynchronously.<N,S extends InternalKeyedState,SV>
ScreateStateInternal(N defaultNamespace, TypeSerializer<N> namespaceSerializer, StateDescriptor<SV> stateDesc)
Creates and returns a new state for internal usage.void
dispose()
Disposes the object and releases all resources.KeyGroupRange
getKeyGroupRange()
Returns the key groups which this state backend is responsible for.default boolean
requiresLegacySynchronousTimerSnapshots(SnapshotType checkpointType)
Whether the keyed state backend requires legacy synchronous timer snapshots.void
setup(StateRequestHandler stateRequestHandler)
Initializes with some contexts.default void
switchContext(RecordContext<K> context)
By default, a state backend does nothing when a key is switched in async processing.-
Methods inherited from interface org.apache.flink.api.common.state.CheckpointListener
notifyCheckpointAborted, notifyCheckpointComplete
-
Methods inherited from interface org.apache.flink.api.common.state.InternalCheckpointListener
notifyCheckpointSubsumed
-
Methods inherited from interface org.apache.flink.runtime.state.PriorityQueueSetFactory
create, create
-
Methods inherited from interface org.apache.flink.runtime.state.Snapshotable
snapshot
-
-
-
-
Method Detail
-
setup
void setup(@Nonnull StateRequestHandler stateRequestHandler)
Initializes with some contexts.- Parameters:
stateRequestHandler
- which handles state request.
-
createState
@Nonnull <N,S extends State,SV> S createState(@Nonnull N defaultNamespace, @Nonnull TypeSerializer<N> namespaceSerializer, @Nonnull StateDescriptor<SV> stateDesc) throws Exception
Creates and returns a new state.- Type Parameters:
N
- the type of namespace for partitioning.S
- The type of the public API state.SV
- The type of the stored state value.- Parameters:
defaultNamespace
- the default namespace for this state.namespaceSerializer
- the serializer for namespace.stateDesc
- TheStateDescriptor
that contains the name of the state.- Throws:
Exception
- Exceptions may occur during initialization of the state.
-
createStateInternal
@Nonnull <N,S extends InternalKeyedState,SV> S createStateInternal(@Nonnull N defaultNamespace, @Nonnull TypeSerializer<N> namespaceSerializer, @Nonnull StateDescriptor<SV> stateDesc) throws Exception
Creates and returns a new state for internal usage.- Type Parameters:
N
- the type of namespace for partitioning.S
- The type of the public API state.SV
- The type of the stored state value.- Parameters:
defaultNamespace
- the default namespace for this state.namespaceSerializer
- the serializer for namespace.stateDesc
- TheStateDescriptor
that contains the name of the state.- Throws:
Exception
- Exceptions may occur during initialization of the state.
-
createStateExecutor
@Nonnull StateExecutor createStateExecutor()
Creates aStateExecutor
which supports to execute a batch of state requests asynchronously.Notice that the
AsyncKeyedStateBackend
is responsible for shutting down the StateExecutors created by itself when they are no longer in use.- Returns:
- a
StateExecutor
which supports to execute a batch of state requests asynchronously.
-
getKeyGroupRange
KeyGroupRange getKeyGroupRange()
Returns the key groups which this state backend is responsible for.
-
switchContext
default void switchContext(RecordContext<K> context)
By default, a state backend does nothing when a key is switched in async processing.- Specified by:
switchContext
in interfaceAsyncExecutionController.SwitchContextListener<K>
-
requiresLegacySynchronousTimerSnapshots
default boolean requiresLegacySynchronousTimerSnapshots(SnapshotType checkpointType)
Whether the keyed state backend requires legacy synchronous timer snapshots.- Parameters:
checkpointType
-- Returns:
- true as default in case of AsyncKeyedStateBackend
-
dispose
void dispose()
Description copied from interface:Disposable
Disposes the object and releases all resources. After calling this method, calling any methods on the object may result in undefined behavior.- Specified by:
dispose
in interfaceDisposable
-
-