Interface StateManager
@Experimental
public interface StateManager
This is responsibility for managing runtime information related to state of process function.
-
Method Summary
Modifier and TypeMethodDescription<K> KGet the key of current record.<IN,ACC, OUT>
org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT> getState(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN, ACC, OUT> stateDeclaration) Get the specific aggregating state.<K,V> org.apache.flink.api.common.state.BroadcastState<K, V> getState(org.apache.flink.api.common.state.BroadcastStateDeclaration<K, V> stateDeclaration) Get the specific broadcast state.<T> org.apache.flink.api.common.state.v2.ListState<T>getState(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration) Get the specific list state.<K,V> org.apache.flink.api.common.state.v2.MapState<K, V> getState(org.apache.flink.api.common.state.MapStateDeclaration<K, V> stateDeclaration) Get the specific map state.<T> org.apache.flink.api.common.state.v2.ReducingState<T>getState(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration) Get the specific reducing state.<T> org.apache.flink.api.common.state.v2.ValueState<T>getState(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration) Get the specific value state.<IN,ACC, OUT>
Optional<org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT>> getStateOptional(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN, ACC, OUT> stateDeclaration) Get the optional of the specific aggregating state.<K,V> Optional<org.apache.flink.api.common.state.BroadcastState<K, V>> getStateOptional(org.apache.flink.api.common.state.BroadcastStateDeclaration<K, V> stateDeclaration) Get the optional of the specific broadcast state.<T> Optional<org.apache.flink.api.common.state.v2.ListState<T>>getStateOptional(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration) Get the optional of the specific list state.<K,V> Optional<org.apache.flink.api.common.state.v2.MapState<K, V>> getStateOptional(org.apache.flink.api.common.state.MapStateDeclaration<K, V> stateDeclaration) Get the optional of the specific map state.<T> Optional<org.apache.flink.api.common.state.v2.ReducingState<T>>getStateOptional(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration) Get the optional of the specific reducing state.<T> Optional<org.apache.flink.api.common.state.v2.ValueState<T>>getStateOptional(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration) Get the optional of the specific value state.
-
Method Details
-
getCurrentKey
Get the key of current record.- Returns:
- The key of current processed record.
- Throws:
UnsupportedOperationException- if the key can not be extracted for this function, for instance, get the key from a non-keyed partition stream.
-
getStateOptional
<T> Optional<org.apache.flink.api.common.state.v2.ListState<T>> getStateOptional(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration) throws Exception Get the optional of the specific list state.- Parameters:
stateDeclaration- of this state.- Returns:
- the list state corresponds to the state declaration, this may be empty.
- Throws:
Exception
-
getState
<T> org.apache.flink.api.common.state.v2.ListState<T> getState(org.apache.flink.api.common.state.ListStateDeclaration<T> stateDeclaration) throws Exception Get the specific list state.- Parameters:
stateDeclaration- of this state.- Returns:
- the list state corresponds to the state declaration
- Throws:
RuntimeException- if the state is not available.Exception
-
getStateOptional
<T> Optional<org.apache.flink.api.common.state.v2.ValueState<T>> getStateOptional(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration) throws Exception Get the optional of the specific value state.- Parameters:
stateDeclaration- of this state.- Returns:
- the value state corresponds to the state declaration, this may be empty.
- Throws:
Exception
-
getState
<T> org.apache.flink.api.common.state.v2.ValueState<T> getState(org.apache.flink.api.common.state.ValueStateDeclaration<T> stateDeclaration) throws Exception Get the specific value state.- Parameters:
stateDeclaration- of this state.- Returns:
- the value state corresponds to the state declaration.
- Throws:
RuntimeException- if the state is not available.Exception
-
getStateOptional
<K,V> Optional<org.apache.flink.api.common.state.v2.MapState<K,V>> getStateOptional(org.apache.flink.api.common.state.MapStateDeclaration<K, V> stateDeclaration) throws ExceptionGet the optional of the specific map state.- Parameters:
stateDeclaration- of this state.- Returns:
- the map state corresponds to the state declaration, this may be empty.
- Throws:
Exception
-
getState
<K,V> org.apache.flink.api.common.state.v2.MapState<K,V> getState(org.apache.flink.api.common.state.MapStateDeclaration<K, V> stateDeclaration) throws ExceptionGet the specific map state.- Parameters:
stateDeclaration- of this state.- Returns:
- the map state corresponds to the state declaration.
- Throws:
RuntimeException- if the state is not available.Exception
-
getStateOptional
<T> Optional<org.apache.flink.api.common.state.v2.ReducingState<T>> getStateOptional(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration) throws Exception Get the optional of the specific reducing state.- Parameters:
stateDeclaration- of this state.- Returns:
- the reducing state corresponds to the state declaration, this may be empty.
- Throws:
Exception
-
getState
<T> org.apache.flink.api.common.state.v2.ReducingState<T> getState(org.apache.flink.api.common.state.ReducingStateDeclaration<T> stateDeclaration) throws Exception Get the specific reducing state.- Parameters:
stateDeclaration- of this state.- Returns:
- the reducing state corresponds to the state declaration.
- Throws:
RuntimeException- if the state is not available.Exception
-
getStateOptional
<IN,ACC, Optional<org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT> OUT>> getStateOptional(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN, ACC, throws ExceptionOUT> stateDeclaration) Get the optional of the specific aggregating state.- Parameters:
stateDeclaration- of this state.- Returns:
- the aggregating state corresponds to the state declaration, this may be empty.
- Throws:
Exception
-
getState
<IN,ACC, org.apache.flink.api.common.state.v2.AggregatingState<IN,OUT> OUT> getState(org.apache.flink.api.common.state.AggregatingStateDeclaration<IN, ACC, throws ExceptionOUT> stateDeclaration) Get the specific aggregating state.- Parameters:
stateDeclaration- of this state.- Returns:
- the aggregating state corresponds to the state declaration.
- Throws:
RuntimeException- if the state is not available.Exception
-
getStateOptional
<K,V> Optional<org.apache.flink.api.common.state.BroadcastState<K,V>> getStateOptional(org.apache.flink.api.common.state.BroadcastStateDeclaration<K, V> stateDeclaration) throws ExceptionGet the optional of the specific broadcast state.- Parameters:
stateDeclaration- of this state.- Returns:
- the broadcast state corresponds to the state declaration, this may be empty.
- Throws:
Exception
-
getState
<K,V> org.apache.flink.api.common.state.BroadcastState<K,V> getState(org.apache.flink.api.common.state.BroadcastStateDeclaration<K, V> stateDeclaration) throws ExceptionGet the specific broadcast state.- Parameters:
stateDeclaration- of this state.- Returns:
- the broadcast state corresponds to the state declaration.
- Throws:
RuntimeException- if the state is not available.Exception
-