K - The type of the key.N - The type of the namespace.UK - The type of the keys in the state.UV - The type of the values in the state.public class HeapMapState<K,N,UK,UV> extends AbstractHeapState<K,N,Map<UK,UV>,org.apache.flink.api.common.state.MapState<UK,UV>> implements InternalMapState<K,N,UK,UV>
MapState that is snapshotted into files.currentNamespace, keySerializer, namespaceSerializer, stateTable, valueSerializer| Constructor and Description |
|---|
HeapMapState(StateTable<K,N,Map<UK,UV>> stateTable,
org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> valueSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
Map<UK,UV> defaultValue)
Creates a new key/value state for the given hash map of key/value pairs.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(UK userKey) |
Iterable<Map.Entry<UK,UV>> |
entries() |
UV |
get(UK userKey) |
org.apache.flink.api.common.typeutils.TypeSerializer<K> |
getKeySerializer()
Returns the
TypeSerializer for the type of key this state is associated to. |
org.apache.flink.api.common.typeutils.TypeSerializer<N> |
getNamespaceSerializer()
Returns the
TypeSerializer for the type of namespace this state is associated to. |
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<Map<UK,UV>> safeValueSerializer)
Returns the serialized value for the given key and namespace.
|
org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> |
getValueSerializer()
Returns the
TypeSerializer for the type of value this state holds. |
Iterator<Map.Entry<UK,UV>> |
iterator() |
Iterable<UK> |
keys() |
void |
put(UK userKey,
UV userValue) |
void |
putAll(Map<UK,UV> value) |
void |
remove(UK userKey) |
Iterable<UV> |
values() |
clear, getDefaultValue, getStateTable, setCurrentNamespaceclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetCurrentNamespacepublic HeapMapState(StateTable<K,N,Map<UK,UV>> stateTable, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> valueSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, Map<UK,UV> defaultValue)
stateTable - The state table for which this state is associated to.keySerializer - The serializer for the keys.valueSerializer - The serializer for the state.namespaceSerializer - The serializer for the namespace.defaultValue - The default value for the state.public org.apache.flink.api.common.typeutils.TypeSerializer<K> getKeySerializer()
InternalKvStateTypeSerializer for the type of key this state is associated to.getKeySerializer in interface InternalKvState<K,N,Map<UK,UV>>public org.apache.flink.api.common.typeutils.TypeSerializer<N> getNamespaceSerializer()
InternalKvStateTypeSerializer for the type of namespace this state is associated to.getNamespaceSerializer in interface InternalKvState<K,N,Map<UK,UV>>public org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> getValueSerializer()
InternalKvStateTypeSerializer for the type of value this state holds.getValueSerializer in interface InternalKvState<K,N,Map<UK,UV>>public void remove(UK userKey)
public boolean contains(UK userKey)
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<Map<UK,UV>> 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,Map<UK,UV>>getSerializedValue in class AbstractHeapState<K,N,Map<UK,UV>,org.apache.flink.api.common.state.MapState<UK,UV>>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 forwardedCopyright © 2014–2018 The Apache Software Foundation. All rights reserved.