Class CopyOnWriteStateMapSnapshot<K,N,S>

java.lang.Object
org.apache.flink.runtime.state.heap.StateMapSnapshot<K,N,S,CopyOnWriteStateMap<K,N,S>>
org.apache.flink.runtime.state.heap.CopyOnWriteStateMapSnapshot<K,N,S>
Type Parameters:
K - type of key
N - type of namespace
S - type of state

public class CopyOnWriteStateMapSnapshot<K,N,S> extends StateMapSnapshot<K,N,S,CopyOnWriteStateMap<K,N,S>>
This class represents the snapshot of a CopyOnWriteStateMap.

IMPORTANT: Please notice that snapshot integrity of entries in this class rely on proper copy-on-write semantics through the CopyOnWriteStateMap that created the snapshot object, but all objects in this snapshot must be considered as READ-ONLY!. The reason is that the objects held by this class may or may not be deep copies of original objects that may still used in the CopyOnWriteStateMap. This depends for each entry on whether or not it was subject to copy-on-write operations by the CopyOnWriteStateMap. Phrased differently: the CopyOnWriteStateMap provides copy-on-write isolation for this snapshot, but this snapshot does not isolate modifications from the CopyOnWriteStateMap!

  • Field Summary

    Fields inherited from class org.apache.flink.runtime.state.heap.StateMapSnapshot

    owningStateMap
  • Method Summary

    Modifier and Type
    Method
    Description
    org.apache.flink.runtime.state.heap.CopyOnWriteStateMapSnapshot.SnapshotIterator<K,N,S>
    getIterator(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<S> stateSerializer, StateSnapshotTransformer<S> stateSnapshotTransformer)
     
    boolean
     
    void
    Release the snapshot.
    void
    writeState(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<S> stateSerializer, org.apache.flink.core.memory.DataOutputView dov, StateSnapshotTransformer<S> stateSnapshotTransformer)
    Writes the state in this snapshot to output.

    Methods inherited from class org.apache.flink.runtime.state.heap.StateMapSnapshot

    isOwner

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • release

      public void release()
      Description copied from class: StateMapSnapshot
      Release the snapshot.
      Overrides:
      release in class StateMapSnapshot<K,N,S,CopyOnWriteStateMap<K,N,S>>
    • isReleased

      public boolean isReleased()
    • getIterator

      public org.apache.flink.runtime.state.heap.CopyOnWriteStateMapSnapshot.SnapshotIterator<K,N,S> getIterator(@Nonnull org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, @Nonnull org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, @Nonnull org.apache.flink.api.common.typeutils.TypeSerializer<S> stateSerializer, @Nullable StateSnapshotTransformer<S> stateSnapshotTransformer)
      Specified by:
      getIterator in class StateMapSnapshot<K,N,S,CopyOnWriteStateMap<K,N,S>>
    • writeState

      public void writeState(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<S> stateSerializer, @Nonnull org.apache.flink.core.memory.DataOutputView dov, @Nullable StateSnapshotTransformer<S> stateSnapshotTransformer) throws IOException
      Description copied from class: StateMapSnapshot
      Writes the state in this snapshot to output. The state need to be transformed with the given transformer if the transformer is non-null.
      Specified by:
      writeState in class StateMapSnapshot<K,N,S,CopyOnWriteStateMap<K,N,S>>
      Parameters:
      keySerializer - the key serializer.
      namespaceSerializer - the namespace serializer.
      stateSerializer - the state serializer.
      dov - the output.
      stateSnapshotTransformer - state transformer, and can be null.
      Throws:
      IOException - on write-related problems.