K
- The type of key the state is associated toN
- The type of the namespaceV
- The type of values kept internally in statepublic interface InternalKvState<K,N,V> extends State
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
Modifier and Type | Interface and Description |
---|---|
static interface |
InternalKvState.StateIncrementalVisitor<K,N,V>
The state entry visitor which supports remove and update of the last returned entries.
|
Modifier and Type | Method and Description |
---|---|
TypeSerializer<K> |
getKeySerializer()
Returns the
TypeSerializer for the type of key this state is associated to. |
TypeSerializer<N> |
getNamespaceSerializer()
Returns the
TypeSerializer for the type of namespace this state is associated to. |
byte[] |
getSerializedValue(byte[] serializedKeyAndNamespace,
TypeSerializer<K> safeKeySerializer,
TypeSerializer<N> safeNamespaceSerializer,
TypeSerializer<V> safeValueSerializer)
Returns the serialized value for the given key and namespace.
|
InternalKvState.StateIncrementalVisitor<K,N,V> |
getStateIncrementalVisitor(int recommendedMaxNumberOfReturnedRecords)
Get global visitor of state entries.
|
TypeSerializer<V> |
getValueSerializer()
Returns the
TypeSerializer for the type of value this state holds. |
void |
setCurrentNamespace(N namespace)
Sets the current namespace, which will be used when using the state access methods.
|
TypeSerializer<K> getKeySerializer()
TypeSerializer
for the type of key this state is associated to.TypeSerializer<N> getNamespaceSerializer()
TypeSerializer
for the type of namespace this state is associated to.TypeSerializer<V> getValueSerializer()
TypeSerializer
for 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, 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.
serializedKeyAndNamespace
- Serialized key and namespacesafeKeySerializer
- A key serializer which is safe to be used even in multi-threaded
contextsafeNamespaceSerializer
- A namespace serializer which is safe to be used even in
multi-threaded contextsafeValueSerializer
- A value serializer which is safe to be used even in multi-threaded
contextnull
if no value is associated with the key and
namespace.Exception
- Exceptions during serialization are forwardedInternalKvState.StateIncrementalVisitor<K,N,V> getStateIncrementalVisitor(int recommendedMaxNumberOfReturnedRecords)
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.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.