T
- Type of values that this list state keeps.@PublicEvolving public interface ListState<T> extends MergingState<T,Iterable<T>>
State
interface for partitioned list state in Operations. The state is accessed and
modified by user functions, and checkpointed consistently by the system as part of the
distributed snapshots.
The state can be a keyed list state or an operator list state.
When it is a keyed list state, it is accessed 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.
When it is an operator list state, the list is a collection of state items that are independent from each other and eligible for redistribution across operator instances in case of changed operator parallelism.
Modifier and Type | Method and Description |
---|---|
void |
addAll(List<T> values)
Updates the operator state accessible by
AppendingState.get() by adding the given values to
existing list of values. |
void |
update(List<T> values)
Updates the operator state accessible by
AppendingState.get() by updating existing values to the
given list of values. |
add, get
void update(List<T> values) throws Exception
AppendingState.get()
by updating existing values to the
given list of values. The next time AppendingState.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.
values
- The new values for the state.Exception
- The method may forward exception thrown internally (by I/O or functions, or
sanity check for null value).void addAll(List<T> values) throws Exception
AppendingState.get()
by adding the given values to
existing list of values. The next time AppendingState.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.
values
- The new values to be added to the state.Exception
- The method may forward exception thrown internally (by I/O or functions, or
sanity check for null value).Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.