Class MemCheckpointStreamFactory
- java.lang.Object
-
- org.apache.flink.runtime.state.memory.MemCheckpointStreamFactory
-
- All Implemented Interfaces:
CheckpointStreamFactory
- Direct Known Subclasses:
NonPersistentMetadataCheckpointStorageLocation
,PersistentMetadataCheckpointStorageLocation
public class MemCheckpointStreamFactory extends Object implements CheckpointStreamFactory
CheckpointStreamFactory
that produces streams that write to in-memory byte arrays.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MemCheckpointStreamFactory.MemoryCheckpointOutputStream
ACheckpointStateOutputStream
that writes into a byte array.
-
Constructor Summary
Constructors Constructor Description MemCheckpointStreamFactory(int maxStateSize)
Creates a new in-memory stream factory that accepts states whose serialized forms are up to the given number of bytes.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
canFastDuplicate(StreamStateHandle stateHandle, CheckpointedStateScope scope)
Tells if we can duplicate the givenStreamStateHandle
into the path corresponding to the givenCheckpointedStateScope
.CheckpointStateOutputStream
createCheckpointStateOutputStream(CheckpointedStateScope scope)
Creates an newCheckpointStateOutputStream
.List<StreamStateHandle>
duplicate(List<StreamStateHandle> stateHandles, CheckpointedStateScope scope)
DuplicatesStreamStateHandle
into the path corresponding to * the givenCheckpointedStateScope
.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.flink.runtime.state.CheckpointStreamFactory
couldReuseStateHandle, reusePreviousStateHandle
-
-
-
-
Method Detail
-
createCheckpointStateOutputStream
public CheckpointStateOutputStream createCheckpointStateOutputStream(CheckpointedStateScope scope) throws IOException
Description copied from interface:CheckpointStreamFactory
Creates an newCheckpointStateOutputStream
. When the stream is closed, it returns a state handle that can retrieve the state back.- Specified by:
createCheckpointStateOutputStream
in interfaceCheckpointStreamFactory
- Parameters:
scope
- The state's scope, whether it is exclusive or shared.- Returns:
- An output stream that writes state for the given checkpoint.
- Throws:
IOException
- Exceptions may occur while creating the stream and should be forwarded.
-
canFastDuplicate
public boolean canFastDuplicate(StreamStateHandle stateHandle, CheckpointedStateScope scope)
Description copied from interface:CheckpointStreamFactory
Tells if we can duplicate the givenStreamStateHandle
into the path corresponding to the givenCheckpointedStateScope
.This should be a rather cheap operation, preferably not involving any remote accesses.
- Specified by:
canFastDuplicate
in interfaceCheckpointStreamFactory
- Parameters:
stateHandle
- The handle to duplicatescope
- Scope determining the location to duplicate into- Returns:
- true, if we can perform the duplication
-
duplicate
public List<StreamStateHandle> duplicate(List<StreamStateHandle> stateHandles, CheckpointedStateScope scope) throws IOException
Description copied from interface:CheckpointStreamFactory
DuplicatesStreamStateHandle
into the path corresponding to * the givenCheckpointedStateScope
.You should first check if you can duplicate with
CheckpointStreamFactory.canFastDuplicate(StreamStateHandle, CheckpointedStateScope)
.- Specified by:
duplicate
in interfaceCheckpointStreamFactory
- Parameters:
stateHandles
- The handles to duplicatescope
- Scope determining the location to duplicate into- Returns:
- The duplicated handle
- Throws:
IOException
-
-