Package org.apache.flink.runtime.state
Class DefaultOperatorStateBackend
java.lang.Object
org.apache.flink.runtime.state.DefaultOperatorStateBackend
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.flink.api.common.state.OperatorStateStore,OperatorStateBackend,Snapshotable<SnapshotResult<OperatorStateHandle>>,org.apache.flink.util.Disposable
Default implementation of OperatorStateStore that provides the ability to make snapshots.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default namespace for state in cases where no state name is provided -
Constructor Summary
ConstructorsConstructorDescriptionDefaultOperatorStateBackend(org.apache.flink.api.common.ExecutionConfig executionConfig, org.apache.flink.core.fs.CloseableRegistry closeStreamOnCancelRegistry, Map<String, PartitionableListState<?>> registeredOperatorStates, Map<String, BackendWritableBroadcastState<?, ?>> registeredBroadcastStates, Map<String, PartitionableListState<?>> accessedStatesByName, Map<String, BackendWritableBroadcastState<?, ?>> accessedBroadcastStatesByName, SnapshotStrategyRunner<OperatorStateHandle, ?> snapshotStrategyRunner) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voiddispose()<K,V> org.apache.flink.api.common.state.BroadcastState<K, V> getBroadcastState(org.apache.flink.api.common.state.MapStateDescriptor<K, V> stateDescriptor) <K,V> org.apache.flink.api.common.state.BroadcastState<K, V> getBroadcastState(org.apache.flink.api.common.state.v2.MapStateDescriptor<K, V> stateDescriptor) org.apache.flink.api.common.ExecutionConfig<S> org.apache.flink.api.common.state.ListState<S>getListState(org.apache.flink.api.common.state.ListStateDescriptor<S> stateDescriptor) <S> org.apache.flink.api.common.state.v2.ListState<S>getListState(org.apache.flink.api.common.state.v2.ListStateDescriptor<S> stateDescriptor) <S> org.apache.flink.api.common.state.ListState<S>getUnionListState(org.apache.flink.api.common.state.ListStateDescriptor<S> stateDescriptor) <S> org.apache.flink.api.common.state.v2.ListState<S>getUnionListState(org.apache.flink.api.common.state.v2.ListStateDescriptor<S> stateDescriptor) snapshot(long checkpointId, long timestamp, CheckpointStreamFactory streamFactory, CheckpointOptions checkpointOptions) Operation that writes a snapshot into a stream that is provided by the givenCheckpointStreamFactoryand returns a @RunnableFuturethat gives a state handle to the snapshot.
-
Field Details
-
DEFAULT_OPERATOR_STATE_NAME
The default namespace for state in cases where no state name is provided- See Also:
-
-
Constructor Details
-
DefaultOperatorStateBackend
public DefaultOperatorStateBackend(org.apache.flink.api.common.ExecutionConfig executionConfig, org.apache.flink.core.fs.CloseableRegistry closeStreamOnCancelRegistry, Map<String, PartitionableListState<?>> registeredOperatorStates, Map<String, BackendWritableBroadcastState<?, ?>> registeredBroadcastStates, Map<String, PartitionableListState<?>> accessedStatesByName, Map<String, BackendWritableBroadcastState<?, ?>> accessedBroadcastStatesByName, SnapshotStrategyRunner<OperatorStateHandle, ?> snapshotStrategyRunner)
-
-
Method Details
-
getExecutionConfig
public org.apache.flink.api.common.ExecutionConfig getExecutionConfig() -
getRegisteredStateNames
- Specified by:
getRegisteredStateNamesin interfaceorg.apache.flink.api.common.state.OperatorStateStore
-
getRegisteredBroadcastStateNames
- Specified by:
getRegisteredBroadcastStateNamesin interfaceorg.apache.flink.api.common.state.OperatorStateStore
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
dispose
public void dispose()- Specified by:
disposein interfaceorg.apache.flink.util.Disposable- Specified by:
disposein interfaceOperatorStateBackend
-
getBroadcastState
public <K,V> org.apache.flink.api.common.state.BroadcastState<K,V> getBroadcastState(org.apache.flink.api.common.state.MapStateDescriptor<K, V> stateDescriptor) throws org.apache.flink.util.StateMigrationException- Specified by:
getBroadcastStatein interfaceorg.apache.flink.api.common.state.OperatorStateStore- Throws:
org.apache.flink.util.StateMigrationException
-
getListState
public <S> org.apache.flink.api.common.state.ListState<S> getListState(org.apache.flink.api.common.state.ListStateDescriptor<S> stateDescriptor) throws Exception - Specified by:
getListStatein interfaceorg.apache.flink.api.common.state.OperatorStateStore- Throws:
Exception
-
getUnionListState
public <S> org.apache.flink.api.common.state.ListState<S> getUnionListState(org.apache.flink.api.common.state.ListStateDescriptor<S> stateDescriptor) throws Exception - Specified by:
getUnionListStatein interfaceorg.apache.flink.api.common.state.OperatorStateStore- Throws:
Exception
-
getBroadcastState
public <K,V> org.apache.flink.api.common.state.BroadcastState<K,V> getBroadcastState(org.apache.flink.api.common.state.v2.MapStateDescriptor<K, V> stateDescriptor) throws Exception- Specified by:
getBroadcastStatein interfaceorg.apache.flink.api.common.state.OperatorStateStore- Throws:
Exception
-
getListState
public <S> org.apache.flink.api.common.state.v2.ListState<S> getListState(org.apache.flink.api.common.state.v2.ListStateDescriptor<S> stateDescriptor) throws Exception - Specified by:
getListStatein interfaceorg.apache.flink.api.common.state.OperatorStateStore- Throws:
Exception
-
getUnionListState
public <S> org.apache.flink.api.common.state.v2.ListState<S> getUnionListState(org.apache.flink.api.common.state.v2.ListStateDescriptor<S> stateDescriptor) throws Exception - Specified by:
getUnionListStatein interfaceorg.apache.flink.api.common.state.OperatorStateStore- Throws:
Exception
-
snapshot
@Nonnull public RunnableFuture<SnapshotResult<OperatorStateHandle>> snapshot(long checkpointId, long timestamp, @Nonnull CheckpointStreamFactory streamFactory, @Nonnull CheckpointOptions checkpointOptions) throws Exception Description copied from interface:SnapshotableOperation that writes a snapshot into a stream that is provided by the givenCheckpointStreamFactoryand returns a @RunnableFuturethat gives a state handle to the snapshot. It is up to the implementation if the operation is performed synchronous or asynchronous. In the later case, the returned Runnable must be executed first before obtaining the handle.- Specified by:
snapshotin interfaceSnapshotable<SnapshotResult<OperatorStateHandle>>- 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 runnable future that will yield a
StateObject. - Throws:
Exception
-