Class DefaultKeyedStateStoreV2
- java.lang.Object
-
- org.apache.flink.runtime.state.v2.DefaultKeyedStateStoreV2
-
- All Implemented Interfaces:
KeyedStateStoreV2
public class DefaultKeyedStateStoreV2 extends Object implements KeyedStateStoreV2
Default implementation of KeyedStateStoreV2.
-
-
Constructor Summary
Constructors Constructor Description DefaultKeyedStateStoreV2(AsyncKeyedStateBackend asyncKeyedStateBackend)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <IN,ACC,OUT>
AggregatingState<IN,OUT>getAggregatingState(AggregatingStateDescriptor<IN,ACC,OUT> stateProperties)
Gets a handle to the system's key/value aggregating state.<T> ListState<T>
getListState(ListStateDescriptor<T> stateProperties)
Gets a handle to the system's key / value list state.<UK,UV>
MapState<UK,UV>getMapState(MapStateDescriptor<UK,UV> stateProperties)
Gets a handle to the system's key/value map state.<T> ReducingState<T>
getReducingState(ReducingStateDescriptor<T> stateProperties)
Gets a handle to the system's key/value reducing state.<T> ValueState<T>
getValueState(ValueStateDescriptor<T> stateProperties)
Gets a handle to the system'sValueState
.
-
-
-
Constructor Detail
-
DefaultKeyedStateStoreV2
public DefaultKeyedStateStoreV2(@Nonnull AsyncKeyedStateBackend asyncKeyedStateBackend)
-
-
Method Detail
-
getValueState
public <T> ValueState<T> getValueState(@Nonnull ValueStateDescriptor<T> stateProperties)
Description copied from interface:KeyedStateStoreV2
Gets a handle to the system'sValueState
. The key/value state is only accessible if the function is executed on a KeyedStream. On each access, the state exposes the value for the key of the element currently processed by the function. Each function may have multiple partitioned states, addressed with different names.Because the scope of each value is the key of the currently processed element, and the elements are distributed by the Flink runtime, the system can transparently scale out and redistribute the state and KeyedStream.
- Specified by:
getValueState
in interfaceKeyedStateStoreV2
- Type Parameters:
T
- The type of value stored in the state.- Parameters:
stateProperties
- The descriptor defining the properties of the state.- Returns:
- The partitioned state object.
-
getListState
public <T> ListState<T> getListState(@Nonnull ListStateDescriptor<T> stateProperties)
Description copied from interface:KeyedStateStoreV2
Gets a handle to the system's key / value list state. This state is optimized for state that holds lists. One can adds elements to the list, or retrieve the list as a whole. This state is only accessible if the function is executed on a KeyedStream.- Specified by:
getListState
in interfaceKeyedStateStoreV2
- Type Parameters:
T
- The type of value stored in the state.- Parameters:
stateProperties
- The descriptor defining the properties of the state.- Returns:
- The partitioned state object.
-
getMapState
public <UK,UV> MapState<UK,UV> getMapState(@Nonnull MapStateDescriptor<UK,UV> stateProperties)
Description copied from interface:KeyedStateStoreV2
Gets a handle to the system's key/value map state. This state is only accessible if the function is executed on a KeyedStream.- Specified by:
getMapState
in interfaceKeyedStateStoreV2
- Type Parameters:
UK
- The type of the user keys stored in the state.UV
- The type of the user values stored in the state.- Parameters:
stateProperties
- The descriptor defining the properties of the state.- Returns:
- The partitioned state object.
-
getReducingState
public <T> ReducingState<T> getReducingState(@Nonnull ReducingStateDescriptor<T> stateProperties)
Description copied from interface:KeyedStateStoreV2
Gets a handle to the system's key/value reducing state. This state is optimized for state that aggregates values.This state is only accessible if the function is executed on a KeyedStream.
- Specified by:
getReducingState
in interfaceKeyedStateStoreV2
- Type Parameters:
T
- The type of value stored in the state.- Parameters:
stateProperties
- The descriptor defining the properties of the stats.- Returns:
- The partitioned state object.
-
getAggregatingState
public <IN,ACC,OUT> AggregatingState<IN,OUT> getAggregatingState(@Nonnull AggregatingStateDescriptor<IN,ACC,OUT> stateProperties)
Description copied from interface:KeyedStateStoreV2
Gets a handle to the system's key/value aggregating state. This state is only accessible if the function is executed on a KeyedStream.- Specified by:
getAggregatingState
in interfaceKeyedStateStoreV2
- Type Parameters:
IN
- The type of the values that are added to the state.ACC
- The type of the accumulator (intermediate aggregation state).OUT
- The type of the values that are returned from the state.- Parameters:
stateProperties
- The descriptor defining the properties of the stats.- Returns:
- The partitioned state object.
-
-