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() |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
couldReuseStateHandle, reusePreviousStateHandle
public MemCheckpointStreamFactory(int maxStateSize)
maxStateSize
- The maximal size of the serialized statepublic CheckpointStateOutputStream createCheckpointStateOutputStream(CheckpointedStateScope scope) throws IOException
CheckpointStreamFactory
CheckpointStateOutputStream
. When the stream is closed, it returns a
state handle that can retrieve the state back.createCheckpointStateOutputStream
in interface CheckpointStreamFactory
scope
- 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)
CheckpointStreamFactory
StreamStateHandle
into the path corresponding to
the given CheckpointedStateScope
.
This should be a rather cheap operation, preferably not involving any remote accesses.
canFastDuplicate
in interface CheckpointStreamFactory
stateHandle
- The handle to duplicatescope
- Scope determining the location to duplicate intopublic List<StreamStateHandle> duplicate(List<StreamStateHandle> stateHandles, CheckpointedStateScope scope) throws IOException
CheckpointStreamFactory
StreamStateHandle
into the path corresponding to * the given CheckpointedStateScope
.
You should first check if you can duplicate with CheckpointStreamFactory.canFastDuplicate(StreamStateHandle, CheckpointedStateScope)
.
duplicate
in interface CheckpointStreamFactory
stateHandles
- The handles to duplicatescope
- Scope determining the location to duplicate intoIOException
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.