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
transferredModifier and Type | Class and Description |
---|---|
static class |
MemoryStateBackend.MemoryCheckpointOutputStream
A CheckpointStateOutputStream that writes into a byte array.
|
AbstractStateBackend.CheckpointStateOutputStream, AbstractStateBackend.CheckpointStateOutputView
currentKey, 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, dropping and aborting all I/O operations that are currently
pending.
|
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> FoldingState<T,ACC> |
createFoldingState(TypeSerializer<N> namespaceSerializer,
FoldingStateDescriptor<T,ACC> stateDesc)
Creates and returns a new
FoldingState . |
<N,T> ListState<T> |
createListState(TypeSerializer<N> namespaceSerializer,
ListStateDescriptor<T> stateDesc)
Creates and returns a new
ListState . |
<N,T> ReducingState<T> |
createReducingState(TypeSerializer<N> namespaceSerializer,
ReducingStateDescriptor<T> stateDesc)
Creates and returns a new
ReducingState . |
<N,V> ValueState<V> |
createValueState(TypeSerializer<N> namespaceSerializer,
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, snapshotPartitionedState
public MemoryStateBackend()
public MemoryStateBackend(int maxStateSize)
maxStateSize
- The maximal size of the serialized statepublic void disposeAllStateForCurrentJob()
AbstractStateBackend
disposeAllStateForCurrentJob
in class AbstractStateBackend
public void close()
AbstractStateBackend
close
in interface Closeable
close
in interface AutoCloseable
close
in class AbstractStateBackend
public <N,V> ValueState<V> createValueState(TypeSerializer<N> namespaceSerializer, ValueStateDescriptor<V> stateDesc) throws Exception
AbstractStateBackend
ValueState
.createValueState
in class AbstractStateBackend
N
- 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.Exception
public <N,T> ListState<T> createListState(TypeSerializer<N> namespaceSerializer, ListStateDescriptor<T> stateDesc) throws Exception
AbstractStateBackend
ListState
.createListState
in class AbstractStateBackend
N
- 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.Exception
public <N,T> ReducingState<T> createReducingState(TypeSerializer<N> namespaceSerializer, ReducingStateDescriptor<T> stateDesc) throws Exception
AbstractStateBackend
ReducingState
.createReducingState
in class AbstractStateBackend
N
- 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.Exception
public <N,T,ACC> FoldingState<T,ACC> createFoldingState(TypeSerializer<N> namespaceSerializer, FoldingStateDescriptor<T,ACC> stateDesc) throws Exception
AbstractStateBackend
FoldingState
.createFoldingState
in class AbstractStateBackend
N
- 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.Exception
public <S extends Serializable> StateHandle<S> checkpointStateSerializable(S state, long checkpointID, long timestamp) throws Exception
checkpointStateSerializable
in class AbstractStateBackend
S
- 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
AbstractStateBackend
createCheckpointStateOutputStream
in class AbstractStateBackend
checkpointID
- 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–2017 The Apache Software Foundation. All rights reserved.