K - The type of the key in the snapshot state.N - The type of the namespace in the snapshot state.SV - The type of the value in the snapshot state.public abstract class AbstractMemStateSnapshot<K,N,SV,S extends org.apache.flink.api.common.state.State,SD extends org.apache.flink.api.common.state.StateDescriptor<S,?>> extends Object implements KvStateSnapshot<K,N,S,SD,MemoryStateBackend>
MemValueState for a checkpoint. The data is stored in a heap byte
array, in serialized form.| Modifier and Type | Field and Description |
|---|---|
protected org.apache.flink.api.common.typeutils.TypeSerializer<K> |
keySerializer
Key Serializer
|
protected org.apache.flink.api.common.typeutils.TypeSerializer<N> |
namespaceSerializer
Namespace Serializer
|
protected SD |
stateDesc
StateDescriptor, for sanity checks
|
protected org.apache.flink.api.common.typeutils.TypeSerializer<SV> |
stateSerializer
Serializer for the state value
|
| Constructor and Description |
|---|
AbstractMemStateSnapshot(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,
byte[] data)
Creates a new heap memory state snapshot.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
abstract KvState<K,N,S,SD,MemoryStateBackend> |
createMemState(HashMap<N,Map<K,SV>> stateMap) |
void |
discardState()
Discarding the heap state is a no-op.
|
long |
getStateSize()
Returns the size of the state in bytes.
|
KvState<K,N,S,SD,MemoryStateBackend> |
restoreState(MemoryStateBackend stateBackend,
org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
ClassLoader classLoader)
Loads the key/value state back from this snapshot.
|
protected final org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer
protected final org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer
protected final org.apache.flink.api.common.typeutils.TypeSerializer<SV> stateSerializer
public AbstractMemStateSnapshot(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, byte[] data)
keySerializer - The serializer for the keys.namespaceSerializer - The serializer for the namespace.stateSerializer - The serializer for the elements in the state HashMapstateDesc - The state identifierdata - The serialized data of the state key/value pairspublic abstract KvState<K,N,S,SD,MemoryStateBackend> createMemState(HashMap<N,Map<K,SV>> stateMap)
public KvState<K,N,S,SD,MemoryStateBackend> restoreState(MemoryStateBackend stateBackend, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, ClassLoader classLoader) throws Exception
KvStateSnapshotrestoreState in interface KvStateSnapshot<K,N,S extends org.apache.flink.api.common.state.State,SD extends org.apache.flink.api.common.state.StateDescriptor<S,?>,MemoryStateBackend>stateBackend - The state backend that created this snapshot and can restore the key/value state
from this snapshot.keySerializer - The serializer for the keys.classLoader - The class loader for user-defined types.Exception - Exceptions can occur during the state loading and are forwarded.public void discardState()
discardState in interface StateObjectpublic long getStateSize()
StateObjectIf the the size is not known, return 0.
getStateSize in interface StateObjectpublic void close()
close in interface Closeableclose in interface AutoCloseableCopyright © 2014–2016 The Apache Software Foundation. All rights reserved.