Class MemCheckpointStreamFactory
java.lang.Object
org.apache.flink.runtime.state.memory.MemCheckpointStreamFactory
- All Implemented Interfaces:
CheckpointStreamFactory
- Direct Known Subclasses:
NonPersistentMetadataCheckpointStorageLocation,PersistentMetadataCheckpointStorageLocation
CheckpointStreamFactory that produces streams that write to in-memory byte arrays.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classACheckpointStateOutputStreamthat writes into a byte array. -
Constructor Summary
ConstructorsConstructorDescriptionMemCheckpointStreamFactory(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
Modifier and TypeMethodDescriptionbooleancanFastDuplicate(StreamStateHandle stateHandle, CheckpointedStateScope scope) Tells if we can duplicate the givenStreamStateHandleinto the path corresponding to the givenCheckpointedStateScope.Creates an newCheckpointStateOutputStream.duplicate(List<StreamStateHandle> stateHandles, CheckpointedStateScope scope) DuplicatesStreamStateHandleinto the path corresponding to * the givenCheckpointedStateScope.toString()Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.flink.runtime.state.CheckpointStreamFactory
couldReuseStateHandle, reusePreviousStateHandle
-
Constructor Details
-
MemCheckpointStreamFactory
public MemCheckpointStreamFactory(int maxStateSize) Creates a new in-memory stream factory that accepts states whose serialized forms are up to the given number of bytes.- Parameters:
maxStateSize- The maximal size of the serialized state
-
-
Method Details
-
createCheckpointStateOutputStream
public CheckpointStateOutputStream createCheckpointStateOutputStream(CheckpointedStateScope scope) throws IOException Description copied from interface:CheckpointStreamFactoryCreates an newCheckpointStateOutputStream. When the stream is closed, it returns a state handle that can retrieve the state back.- Specified by:
createCheckpointStateOutputStreamin 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
Description copied from interface:CheckpointStreamFactoryTells if we can duplicate the givenStreamStateHandleinto the path corresponding to the givenCheckpointedStateScope.This should be a rather cheap operation, preferably not involving any remote accesses.
- Specified by:
canFastDuplicatein 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:CheckpointStreamFactoryDuplicatesStreamStateHandleinto the path corresponding to * the givenCheckpointedStateScope.You should first check if you can duplicate with
CheckpointStreamFactory.canFastDuplicate(StreamStateHandle, CheckpointedStateScope).- Specified by:
duplicatein interfaceCheckpointStreamFactory- Parameters:
stateHandles- The handles to duplicatescope- Scope determining the location to duplicate into- Returns:
- The duplicated handle
- Throws:
IOException
-
toString
-