K
- The type of the key.N
- The type of the namespace.SV
- The type of the values in the state.S
- The type of StateSD
- The type of StateDescriptor for the State SBackend
- The type of the backend that snapshots this key/value state.public abstract class AbstractHeapState<K,N,SV,S extends org.apache.flink.api.common.state.State,SD extends org.apache.flink.api.common.state.StateDescriptor<S,?>,Backend extends AbstractStateBackend> extends Object implements KvState<K,N,S,SD,Backend>, org.apache.flink.api.common.state.State
ListState
implementations that are backed by a regular
heap hash map. The concrete implementations define how the state is checkpointed.Modifier and Type | Field and Description |
---|---|
protected K |
currentKey
The current key, which the next value methods will refer to
|
protected N |
currentNamespace
The current namespace, which the access methods will refer to.
|
protected Map<K,SV> |
currentNSState
Cache the state map for the current key.
|
protected org.apache.flink.api.common.typeutils.TypeSerializer<K> |
keySerializer
The serializer for the keys
|
protected org.apache.flink.api.common.typeutils.TypeSerializer<N> |
namespaceSerializer
The serializer for the namespace
|
protected HashMap<N,Map<K,SV>> |
state
Map containing the actual key/value pairs
|
protected SD |
stateDesc
This holds the name of the state and can create an initial default value for the state.
|
protected org.apache.flink.api.common.typeutils.TypeSerializer<SV> |
stateSerializer
Serializer for the state value.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractHeapState(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<SV> stateSerializer,
SD stateDesc)
Creates a new empty key/value state.
|
protected |
AbstractHeapState(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<SV> stateSerializer,
SD stateDesc,
HashMap<N,Map<K,SV>> state)
Creates a new key/value state for the given hash map of key/value pairs.
|
Modifier and Type | Method and Description |
---|---|
void |
clear() |
void |
dispose()
Disposes the key/value state, releasing all occupied resources.
|
org.apache.flink.api.common.typeutils.TypeSerializer<K> |
getKeySerializer()
Gets the serializer for the keys.
|
org.apache.flink.api.common.typeutils.TypeSerializer<N> |
getNamespaceSerializer()
Gets the serializer for the namespace.
|
void |
setCurrentKey(K currentKey)
Sets the current key, which will be used when using the state access methods.
|
void |
setCurrentNamespace(N namespace)
Sets the current namespace, which will be used when using the state access methods.
|
protected int |
size()
Returns the number of all state pairs in this state, across namespaces.
|
protected final org.apache.flink.api.common.typeutils.TypeSerializer<SV> stateSerializer
protected final org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer
protected final org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer
protected final SD extends org.apache.flink.api.common.state.StateDescriptor<S,?> stateDesc
protected K currentKey
protected N currentNamespace
protected AbstractHeapState(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<SV> stateSerializer, SD stateDesc)
keySerializer
- The serializer for the keys.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.protected AbstractHeapState(org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<SV> stateSerializer, SD stateDesc, HashMap<N,Map<K,SV>> state)
keySerializer
- The serializer for the keys.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.state
- The state map to use in this kev/value state. May contain initial state.public final void clear()
clear
in interface org.apache.flink.api.common.state.State
public final void setCurrentKey(K currentKey)
KvState
setCurrentKey
in interface KvState<K,N,S extends org.apache.flink.api.common.state.State,SD extends org.apache.flink.api.common.state.StateDescriptor<S,?>,Backend extends AbstractStateBackend>
currentKey
- The key.public final void setCurrentNamespace(N namespace)
KvState
setCurrentNamespace
in interface KvState<K,N,S extends org.apache.flink.api.common.state.State,SD extends org.apache.flink.api.common.state.StateDescriptor<S,?>,Backend extends AbstractStateBackend>
namespace
- The namespace.protected final int size()
public void dispose()
KvState
public final org.apache.flink.api.common.typeutils.TypeSerializer<K> getKeySerializer()
public final org.apache.flink.api.common.typeutils.TypeSerializer<N> getNamespaceSerializer()
Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.