public class MemoryStateBackend extends AbstractStateBackend
AbstractStateBackend that stores all its data and checkpoints in memory and has no
capabilities to spill to disk. Checkpoints are serialized and the serialized data is
transferred| Modifier and Type | Class and Description |
|---|---|
static class |
MemoryStateBackend.MemoryCheckpointOutputStream
A CheckpointStateOutputStream that writes into a byte array.
|
AbstractStateBackend.CheckpointStateOutputStream, AbstractStateBackend.CheckpointStateOutputViewcurrentKey, keySerializer, keyValueStatesByName, userCodeClassLoader| Constructor and Description |
|---|
MemoryStateBackend()
Creates a new memory state backend that accepts states whose serialized forms are
up to the default state size (5 MB).
|
MemoryStateBackend(int maxStateSize)
Creates a new memory state backend that accepts states whose serialized forms are
up to the given number of bytes.
|
| Modifier and Type | Method and Description |
|---|---|
<S extends Serializable> |
checkpointStateSerializable(S state,
long checkpointID,
long timestamp)
Serialized the given state into bytes using Java serialization and creates a state handle that
can re-create that state.
|
void |
close()
Closes the state backend, releasing all internal resources, but does not delete any persistent
checkpoint data.
|
static MemoryStateBackend |
create()
Gets the default instance of this state backend, using the default maximal state size.
|
AbstractStateBackend.CheckpointStateOutputStream |
createCheckpointStateOutputStream(long checkpointID,
long timestamp)
Creates an output stream that writes into the state of the given checkpoint.
|
<N,T,ACC> org.apache.flink.api.common.state.FoldingState<T,ACC> |
createFoldingState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.FoldingStateDescriptor<T,ACC> stateDesc)
Creates and returns a new
FoldingState. |
<N,T> org.apache.flink.api.common.state.ListState<T> |
createListState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.ListStateDescriptor<T> stateDesc)
Creates and returns a new
ListState. |
<N,T> org.apache.flink.api.common.state.ReducingState<T> |
createReducingState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.ReducingStateDescriptor<T> stateDesc)
Creates and returns a new
ReducingState. |
<N,V> org.apache.flink.api.common.state.ValueState<V> |
createValueState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.ValueStateDescriptor<V> stateDesc)
Creates and returns a new
ValueState. |
void |
disposeAllStateForCurrentJob()
Disposes all state associated with the current job.
|
String |
toString() |
createCheckpointStateOutputView, dispose, getCurrentKey, getPartitionedState, initializeForJob, injectKeyValueStateSnapshots, mergePartitionedStates, notifyOfCompletedCheckpoint, setCurrentKey, snapshotPartitionedStatepublic MemoryStateBackend()
public MemoryStateBackend(int maxStateSize)
maxStateSize - The maximal size of the serialized statepublic void disposeAllStateForCurrentJob()
AbstractStateBackenddisposeAllStateForCurrentJob in class AbstractStateBackendpublic void close()
throws Exception
AbstractStateBackendclose in class AbstractStateBackendException - Exceptions can be forwarded and will be logged by the systempublic <N,V> org.apache.flink.api.common.state.ValueState<V> createValueState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.ValueStateDescriptor<V> stateDesc)
throws Exception
AbstractStateBackendValueState.createValueState in class AbstractStateBackendN - The type of the namespace.V - The type of the value that the ValueState can store.namespaceSerializer - TypeSerializer for the state namespace.stateDesc - The StateDescriptor that contains the name of the state.Exceptionpublic <N,T> org.apache.flink.api.common.state.ListState<T> createListState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.ListStateDescriptor<T> stateDesc)
throws Exception
AbstractStateBackendListState.createListState in class AbstractStateBackendN - The type of the namespace.T - The type of the values that the ListState can store.namespaceSerializer - TypeSerializer for the state namespace.stateDesc - The StateDescriptor that contains the name of the state.Exceptionpublic <N,T> org.apache.flink.api.common.state.ReducingState<T> createReducingState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.ReducingStateDescriptor<T> stateDesc)
throws Exception
AbstractStateBackendReducingState.createReducingState in class AbstractStateBackendN - The type of the namespace.T - The type of the values that the ListState can store.namespaceSerializer - TypeSerializer for the state namespace.stateDesc - The StateDescriptor that contains the name of the state.Exceptionpublic <N,T,ACC> org.apache.flink.api.common.state.FoldingState<T,ACC> createFoldingState(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.FoldingStateDescriptor<T,ACC> stateDesc)
throws Exception
AbstractStateBackendFoldingState.createFoldingState in class AbstractStateBackendN - The type of the namespace.T - Type of the values folded into the stateACC - Type of the value in the state *namespaceSerializer - TypeSerializer for the state namespace.stateDesc - The StateDescriptor that contains the name of the state.Exceptionpublic <S extends Serializable> StateHandle<S> checkpointStateSerializable(S state, long checkpointID, long timestamp) throws Exception
checkpointStateSerializable in class AbstractStateBackendS - The type of the state.state - The state to checkpoint.checkpointID - The ID of the checkpoint.timestamp - The timestamp of the checkpoint.Exception - Thrown, if the serialization fails.public AbstractStateBackend.CheckpointStateOutputStream createCheckpointStateOutputStream(long checkpointID, long timestamp) throws Exception
AbstractStateBackendcreateCheckpointStateOutputStream in class AbstractStateBackendcheckpointID - The ID of the checkpoint.timestamp - The timestamp of the checkpoint.Exception - Exceptions may occur while creating the stream and should be forwarded.public static MemoryStateBackend create()
Copyright © 2014–2016 The Apache Software Foundation. All rights reserved.