Interface ListState<T>

  • Type Parameters:
    T - Type of values that this list state keeps.
    All Superinterfaces:
    AppendingState<T,​StateIterator<T>,​Iterable<T>>, MergingState<T,​StateIterator<T>,​Iterable<T>>, State
    All Known Subinterfaces:
    InternalListState<K,​N,​V>
    All Known Implementing Classes:
    AbstractListState, ForStListState, ListStateAdaptor

    @Experimental
    public interface ListState<T>
    extends MergingState<T,​StateIterator<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.

    • Method Detail

      • asyncUpdate

        StateFuture<Void> asyncUpdate​(List<T> values)
        Updates the operator state accessible by AppendingState.asyncGet() by updating existing values to the given list of values asynchronously. The next time AppendingState.asyncGet() 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.

        Parameters:
        values - The new values for the state.
      • asyncAddAll

        StateFuture<Void> asyncAddAll​(List<T> values)
        Updates the operator state accessible by AppendingState.asyncGet() by adding the given values to existing list of values asynchronously. The next time AppendingState.asyncGet() 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.

        Parameters:
        values - The new values to be added to the state.
      • update

        void update​(List<T> values)
        Updates the operator state accessible by 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.

        Parameters:
        values - The new values for the state.
      • addAll

        void addAll​(List<T> values)
        Updates the operator state accessible by 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.

        Parameters:
        values - The new values to be added to the state.