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
public interface InternalKvState<K,N,V> extends State
InternalKvStateis the root of the internal state type hierarchy, similar to the
Statebeing 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
|Modifier and Type||Method and Description|
Returns the serialized value for the given key and namespace.
Sets the current namespace, which will be used when using the state access methods.
TypeSerializerfor the type of key this state is associated to.
TypeSerializerfor the type of namespace this state is associated to.
TypeSerializerfor the type of value this state holds.
void setCurrentNamespace(N namespace)
namespace- The namespace.
byte getSerializedValue(byte serializedKeyAndNamespace, TypeSerializer<K> safeKeySerializer, TypeSerializer<N> safeNamespaceSerializer, TypeSerializer<V> safeValueSerializer) throws Exception
If no value is associated with key and namespace,
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.
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
nullif no value is associated with the key and namespace.
Exception- Exceptions during serialization are forwarded
Copyright © 2014–2020 The Apache Software Foundation. All rights reserved.