Package org.apache.flink.runtime.state
Class PartitionableListState<S>
- java.lang.Object
-
- org.apache.flink.runtime.state.PartitionableListState<S>
-
- Type Parameters:
S
- the type of an operator state partition.
- All Implemented Interfaces:
AppendingState<S,Iterable<S>>
,ListState<S>
,MergingState<S,Iterable<S>>
,State
public final class PartitionableListState<S> extends Object implements ListState<S>
Implementation of operator list state.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
add(S value)
Updates the operator state accessible byAppendingState.get()
by adding the given value to the list of values.void
addAll(List<S> values)
Updates the operator state accessible byAppendingState.get()
by adding the given values to existing list of values.void
clear()
Removes the value mapped under the current key.PartitionableListState<S>
deepCopy()
Iterable<S>
get()
Returns the current value for the state.ArrayListSerializer<S>
getInternalListCopySerializer()
RegisteredOperatorStateBackendMetaInfo<S>
getStateMetaInfo()
void
setStateMetaInfo(RegisteredOperatorStateBackendMetaInfo<S> stateMetaInfo)
String
toString()
void
update(List<S> values)
Updates the operator state accessible byAppendingState.get()
by updating existing values to the given list of values.long[]
write(FSDataOutputStream out)
-
-
-
Method Detail
-
setStateMetaInfo
public void setStateMetaInfo(RegisteredOperatorStateBackendMetaInfo<S> stateMetaInfo)
-
getStateMetaInfo
public RegisteredOperatorStateBackendMetaInfo<S> getStateMetaInfo()
-
deepCopy
public PartitionableListState<S> deepCopy()
-
clear
public void clear()
Description copied from interface:State
Removes the value mapped under the current key.
-
get
public Iterable<S> get()
Description copied from interface:AppendingState
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
.- Specified by:
get
in interfaceAppendingState<S,Iterable<S>>
- Returns:
- The operator state value corresponding to the current input or
null
if the state is empty.
-
add
public void add(S value)
Description copied from interface:AppendingState
Updates the operator state accessible byAppendingState.get()
by adding the given value to the list of values. The next timeAppendingState.get()
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). TODO: An unified behaviour across all sub-classes.
- Specified by:
add
in interfaceAppendingState<S,Iterable<S>>
- Parameters:
value
- The new value for the state.
-
write
public long[] write(FSDataOutputStream out) throws IOException
- Throws:
IOException
-
update
public void update(List<S> values)
Description copied from interface:ListState
Updates the operator state accessible byAppendingState.get()
by updating existing values to the given list of values. The next timeAppendingState.get()
is called (for the same state partition) the returned state will represent the updated list.If an empty list is passed in, the state value will be null.
Null value passed in or any null value in list is not allowed.
-
addAll
public void addAll(List<S> values)
Description copied from interface:ListState
Updates the operator state accessible byAppendingState.get()
by adding the given values to existing list of values. The next timeAppendingState.get()
is called (for the same state partition) the returned state will represent the updated list.If an empty list is passed in, the state value remains unchanged.
Null value passed in or any null value in list is not allowed.
-
getInternalListCopySerializer
@VisibleForTesting public ArrayListSerializer<S> getInternalListCopySerializer()
-
-