Interface AppendingState<IN,OUT,SYNCOUT>
-
- Type Parameters:
IN
- Type of the value that can be added to the state.OUT
- Type of the value that can be retrieved from the state by asynchronous interface.SYNCOUT
- Type of the value that can be retrieved from the state by synchronous interface.
- All Superinterfaces:
State
- All Known Subinterfaces:
AggregatingState<IN,OUT>
,InternalAggregatingState<K,N,IN,ACC,OUT>
,InternalAppendingState<K,N,IN,SV,OUT,SYNCOUT>
,InternalListState<K,N,V>
,InternalMergingState<K,N,IN,SV,OUT,SYNCOUT>
,InternalReducingState<K,N,T>
,ListState<T>
,MergingState<IN,OUT,SYNCOUT>
,ReducingState<T>
- All Known Implementing Classes:
AbstractAggregatingState
,AbstractListState
,AbstractReducingState
,AggregatingStateAdaptor
,ForStAggregatingState
,ForStListState
,ForStReducingState
,ListStateAdaptor
,MergingStateAdaptor
,ReducingStateAdaptor
@Experimental public interface AppendingState<IN,OUT,SYNCOUT> extends State
Base interface for partitioned state that supports adding elements and inspecting the current state. Elements can either be kept in a buffer (list-like) or aggregated into one value.The state is accessed and modified by user functions, and checkpointed consistently by the system as part of the distributed snapshots.
The state is only accessible by functions applied on a
KeyedStream
. The key is automatically supplied by the system, so the function always sees the value mapped to the key of the current element. That way, the system can handle stream and state partitioning consistently together.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
add(IN value)
Updates the operator state accessible byget()
by adding the given value to the list of values.StateFuture<Void>
asyncAdd(IN value)
Updates the operator state accessible byasyncGet()
by adding the given value to the list of values asynchronously.StateFuture<OUT>
asyncGet()
Returns the current value for the state asynchronously.SYNCOUT
get()
Returns the current value for the state.-
Methods inherited from interface org.apache.flink.api.common.state.v2.State
asyncClear, clear
-
-
-
-
Method Detail
-
asyncGet
StateFuture<OUT> asyncGet()
Returns the current value for the state asynchronously. When the state is not partitioned the returned value is the same for all inputs in a given operator instance. If state partitioning is applied, the value returned depends on the current operator input, as the operator maintains an independent state for each partition.NOTE TO IMPLEMENTERS: if the state is empty, then this method should return
null
wrapped by a StateFuture.- Returns:
- The operator state value corresponding to the current input or
null
wrapped by aStateFuture
if the state is empty.
-
asyncAdd
StateFuture<Void> asyncAdd(IN value)
Updates the operator state accessible byasyncGet()
by adding the given value to the list of values asynchronously. The next timeasyncGet()
is called (for the same state partition) the returned state will represent the updated list.null value is not allowed to be passed in.
- Parameters:
value
- The new value for the state.
-
get
SYNCOUT get()
Returns the current value for the state. When the state is not partitioned the returned value is the same for all inputs in a given operator instance. If state partitioning is applied, the value returned depends on the current operator input, as the operator maintains an independent state for each partition.NOTE TO IMPLEMENTERS: if the state is empty, then this method should return
null
.- Returns:
- The operator state value corresponding to the current input or
null
if the state is empty.
-
add
void add(IN value)
Updates the operator state accessible byget()
by adding the given value to the list of values. The next timeget()
is called (for the same state partition) the returned state will represent the updated list.If null is passed in, the behaviour is undefined (implementation related).
- Parameters:
value
- The new value for the state.
-
-