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
@Internal public class DefaultOperatorStateBackend extends Object implements OperatorStateBackend
Default implementation of OperatorStateStore that provides the ability to make snapshots.
-
-
Field Summary
Fields Modifier and Type Field Description static StringDEFAULT_OPERATOR_STATE_NAMEThe default namespace for state in cases where no state name is provided
-
Constructor Summary
Constructors Constructor Description 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 Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()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.ExecutionConfiggetExecutionConfig()<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)Set<String>getRegisteredBroadcastStateNames()Set<String>getRegisteredStateNames()<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)RunnableFuture<SnapshotResult<OperatorStateHandle>>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 Detail
-
DEFAULT_OPERATOR_STATE_NAME
public static final String DEFAULT_OPERATOR_STATE_NAME
The default namespace for state in cases where no state name is provided- See Also:
- Constant Field Values
-
-
Constructor Detail
-
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 Detail
-
getExecutionConfig
public org.apache.flink.api.common.ExecutionConfig getExecutionConfig()
-
getRegisteredStateNames
public Set<String> getRegisteredStateNames()
- Specified by:
getRegisteredStateNamesin interfaceorg.apache.flink.api.common.state.OperatorStateStore
-
getRegisteredBroadcastStateNames
public Set<String> getRegisteredBroadcastStateNames()
- Specified by:
getRegisteredBroadcastStateNamesin interfaceorg.apache.flink.api.common.state.OperatorStateStore
-
close
public void close() throws IOException- 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
-
-