Class SimpleVersionedListState<T>

java.lang.Object
org.apache.flink.streaming.api.operators.util.SimpleVersionedListState<T>
Type Parameters:
T - The type of the objects stored in the state.
All Implemented Interfaces:
org.apache.flink.api.common.state.AppendingState<T,Iterable<T>>, org.apache.flink.api.common.state.ListState<T>, org.apache.flink.api.common.state.MergingState<T,Iterable<T>>, org.apache.flink.api.common.state.State

public class SimpleVersionedListState<T> extends Object implements org.apache.flink.api.common.state.ListState<T>
A ListState that uses a SimpleVersionedSerializer instead of a TypeSerializer.

The state wraps a ListState of type byte[], meaning it internally keeps only bytes and lazily deserializes them into objects. This has two major implications, compared to a ListState states that uses a TypeSerializer:

  • This state does not participate in >state migration. The bytes are never converted and different state versions are lazily resolved by the versioned serializer.
  • This state is generally slower than states that directly use the TypeSerializer, because of extra copies into byte arrays and extra version encodings.
  • Constructor Details

    • SimpleVersionedListState

      public SimpleVersionedListState(org.apache.flink.api.common.state.ListState<byte[]> rawState, org.apache.flink.core.io.SimpleVersionedSerializer<T> serializer)
      Creates a new SimpleVersionedListState that reads and writes bytes from the given raw ListState with the given serializer.
  • Method Details

    • update

      public void update(@Nullable List<T> values) throws Exception
      Specified by:
      update in interface org.apache.flink.api.common.state.ListState<T>
      Throws:
      Exception
    • addAll

      public void addAll(@Nullable List<T> values) throws Exception
      Specified by:
      addAll in interface org.apache.flink.api.common.state.ListState<T>
      Throws:
      Exception
    • get

      public Iterable<T> get() throws Exception
      Specified by:
      get in interface org.apache.flink.api.common.state.AppendingState<T,Iterable<T>>
      Throws:
      Exception
    • add

      public void add(T value) throws Exception
      Specified by:
      add in interface org.apache.flink.api.common.state.AppendingState<T,Iterable<T>>
      Throws:
      Exception
    • clear

      public void clear()
      Specified by:
      clear in interface org.apache.flink.api.common.state.State