Interface InternalKvState<K,N,V>
-
- Type Parameters:
K
- The type of key the state is associated toN
- The type of the namespaceV
- 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
TheInternalKvState
is the root of the internal state type hierarchy, similar to theState
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
InternalKvState.StateIncrementalVisitor<K,N,V>
The state entry visitor which supports remove and update of the last returned entries.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description TypeSerializer<K>
getKeySerializer()
Returns theTypeSerializer
for the type of key this state is associated to.TypeSerializer<N>
getNamespaceSerializer()
Returns theTypeSerializer
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 theTypeSerializer
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.
-
-
-
Method Detail
-
getKeySerializer
TypeSerializer<K> getKeySerializer()
Returns theTypeSerializer
for the type of key this state is associated to.
-
getNamespaceSerializer
TypeSerializer<N> getNamespaceSerializer()
Returns theTypeSerializer
for the type of namespace this state is associated to.
-
getValueSerializer
TypeSerializer<V> getValueSerializer()
Returns theTypeSerializer
for the type of value this state holds.
-
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 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 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 pernextEntries
call, it can still be exceeded by some smaller constant.- Returns:
- global iterator over state entries
-
-