K - The type of the key.N - The type of the namespace.SV - The type of the values in the state.public abstract class AbstractHeapState<K,N,SV> extends Object implements InternalKvState<K,N,SV>
State implementations that are backed by a regular heap hash
map. The concrete implementations define how the state is checkpointed.InternalKvState.StateIncrementalVisitor<K,N,V>| Modifier and Type | Field and Description |
|---|---|
protected N |
currentNamespace
The current namespace, which the access methods will refer to.
|
protected org.apache.flink.api.common.typeutils.TypeSerializer<K> |
keySerializer |
protected org.apache.flink.api.common.typeutils.TypeSerializer<N> |
namespaceSerializer |
protected StateTable<K,N,SV> |
stateTable
Map containing the actual key/value pairs.
|
protected org.apache.flink.api.common.typeutils.TypeSerializer<SV> |
valueSerializer |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
protected SV |
getDefaultValue() |
byte[] |
getSerializedValue(byte[] serializedKeyAndNamespace,
org.apache.flink.api.common.typeutils.TypeSerializer<K> safeKeySerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<N> safeNamespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<SV> safeValueSerializer)
Returns the serialized value for the given key and namespace.
|
InternalKvState.StateIncrementalVisitor<K,N,SV> |
getStateIncrementalVisitor(int recommendedMaxNumberOfReturnedRecords)
Get global visitor of state entries.
|
StateTable<K,N,SV> |
getStateTable()
This should only be used for testing.
|
void |
setCurrentNamespace(N namespace)
Sets the current namespace, which will be used when using the state access methods.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetKeySerializer, getNamespaceSerializer, getValueSerializerprotected final StateTable<K,N,SV> stateTable
protected N currentNamespace
protected final org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer
protected final org.apache.flink.api.common.typeutils.TypeSerializer<SV> valueSerializer
protected final org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer
public final void clear()
clear in interface org.apache.flink.api.common.state.Statepublic final void setCurrentNamespace(N namespace)
InternalKvStatesetCurrentNamespace in interface InternalKvState<K,N,SV>namespace - The namespace.public byte[] getSerializedValue(byte[] serializedKeyAndNamespace,
org.apache.flink.api.common.typeutils.TypeSerializer<K> safeKeySerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<N> safeNamespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<SV> safeValueSerializer)
throws Exception
InternalKvStateIf 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.
getSerializedValue in interface InternalKvState<K,N,SV>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 forwarded@VisibleForTesting public StateTable<K,N,SV> getStateTable()
protected SV getDefaultValue()
public InternalKvState.StateIncrementalVisitor<K,N,SV> getStateIncrementalVisitor(int recommendedMaxNumberOfReturnedRecords)
InternalKvStategetStateIncrementalVisitor in interface InternalKvState<K,N,SV>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–2023 The Apache Software Foundation. All rights reserved.