public class MemCheckpointStreamFactory extends Object implements CheckpointStreamFactory
CheckpointStreamFactory that produces streams that write to in-memory byte arrays.| Modifier and Type | Class and Description |
|---|---|
static class |
MemCheckpointStreamFactory.MemoryCheckpointOutputStream
A
CheckpointStateOutputStream that writes into a byte array. |
| Constructor and 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.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
canFastDuplicate(StreamStateHandle stateHandle,
CheckpointedStateScope scope)
Tells if we can duplicate the given
StreamStateHandle into the path corresponding to
the given CheckpointedStateScope. |
CheckpointStateOutputStream |
createCheckpointStateOutputStream(CheckpointedStateScope scope)
Creates an new
CheckpointStateOutputStream. |
List<StreamStateHandle> |
duplicate(List<StreamStateHandle> stateHandles,
CheckpointedStateScope scope)
Duplicates
StreamStateHandle into the path corresponding to * the given CheckpointedStateScope. |
String |
toString() |
public MemCheckpointStreamFactory(int maxStateSize)
maxStateSize - The maximal size of the serialized statepublic CheckpointStateOutputStream createCheckpointStateOutputStream(CheckpointedStateScope scope) throws IOException
CheckpointStreamFactoryCheckpointStateOutputStream. When the stream is closed, it returns a
state handle that can retrieve the state back.createCheckpointStateOutputStream in interface CheckpointStreamFactoryscope - The state's scope, whether it is exclusive or shared.IOException - Exceptions may occur while creating the stream and should be forwarded.public boolean canFastDuplicate(StreamStateHandle stateHandle, CheckpointedStateScope scope)
CheckpointStreamFactoryStreamStateHandle into the path corresponding to
the given CheckpointedStateScope.
This should be a rather cheap operation, preferably not involving any remote accesses.
canFastDuplicate in interface CheckpointStreamFactorystateHandle - The handle to duplicatescope - Scope determining the location to duplicate intopublic List<StreamStateHandle> duplicate(List<StreamStateHandle> stateHandles, CheckpointedStateScope scope) throws IOException
CheckpointStreamFactoryStreamStateHandle into the path corresponding to * the given CheckpointedStateScope.
You should first check if you can duplicate with CheckpointStreamFactory.canFastDuplicate(StreamStateHandle, CheckpointedStateScope).
duplicate in interface CheckpointStreamFactorystateHandles - The handles to duplicatescope - Scope determining the location to duplicate intoIOExceptionCopyright © 2014–2022 The Apache Software Foundation. All rights reserved.