Interface InternalKvState<K,​N,​V>

  • Type Parameters:
    K - The type of key the state is associated to
    N - The type of the namespace
    V - The type of values kept internally in state
    All Superinterfaces:
    State
    All Known Subinterfaces:
    InternalAggregatingState<K,​N,​IN,​SV,​OUT>, InternalAppendingState<K,​N,​IN,​SV,​OUT>, InternalListState<K,​N,​T>, InternalMapState<K,​N,​UK,​UV>, InternalMergingState<K,​N,​IN,​SV,​OUT>, InternalReducingState<K,​N,​T>, InternalValueState<K,​N,​T>
    All Known Implementing Classes:
    AbstractForStSyncState, AbstractHeapState, AbstractRocksDBState

    public interface InternalKvState<K,​N,​V>
    extends State
    The InternalKvState is the root of the internal state type hierarchy, similar to the State being the root of the public API state hierarchy.

    The internal state classes give access to the namespace getters and setters and access to additional functionality, like raw value access or state merging.

    The public API state hierarchy is intended to be programmed against by Flink applications. The internal state hierarchy holds all the auxiliary methods that are used by the runtime and not intended to be used by user applications. These internal methods are considered of limited use to users and only confusing, and are usually not regarded as stable across releases.

    Each specific type in the internal state hierarchy extends the type from the public state hierarchy:

                 State
                   |
                   +-------------------InternalKvState
                   |                         |
              MergingState                   |
                   |                         |
                   +-----------------InternalMergingState
                   |                         |
          +--------+------+                  |
          |               |                  |
     ReducingState    ListState        +-----+-----------------+
          |               |            |                       |
          +-----------+   +-----------   -----------------InternalListState
                      |                |
                      +---------InternalReducingState
     
    • Method Detail

      • getNamespaceSerializer

        TypeSerializer<N> getNamespaceSerializer()
        Returns the TypeSerializer for the type of namespace this state is associated to.
      • setCurrentNamespace

        void setCurrentNamespace​(N namespace)
        Sets the current namespace, which will be used when using the state access methods.
        Parameters:
        namespace - The namespace.
      • getSerializedValue

        byte[] getSerializedValue​(byte[] serializedKeyAndNamespace,
                                  TypeSerializer<K> safeKeySerializer,
                                  TypeSerializer<N> safeNamespaceSerializer,
                                  TypeSerializer<V> safeValueSerializer)
                           throws Exception
        Returns the serialized value for the given key and namespace.

        If no value is associated with key and namespace, null is returned.

        TO IMPLEMENTERS: This method is called by multiple threads. Anything stateful (e.g. serializers) should be either duplicated or protected from undesired consequences of concurrent invocations.

        Parameters:
        serializedKeyAndNamespace - Serialized key and namespace
        safeKeySerializer - A key serializer which is safe to be used even in multi-threaded context
        safeNamespaceSerializer - A namespace serializer which is safe to be used even in multi-threaded context
        safeValueSerializer - A value serializer which is safe to be used even in multi-threaded context
        Returns:
        Serialized value or null if no value is associated with the key and namespace.
        Throws:
        Exception - Exceptions during serialization are forwarded
      • getStateIncrementalVisitor

        InternalKvState.StateIncrementalVisitor<K,​N,​V> getStateIncrementalVisitor​(int recommendedMaxNumberOfReturnedRecords)
        Get global visitor of state entries.
        Parameters:
        recommendedMaxNumberOfReturnedRecords - hint to the visitor not to exceed this number of returned records per nextEntries call, it can still be exceeded by some smaller constant.
        Returns:
        global iterator over state entries