K
- The type of the key in the snapshot state.N
- The type of the namespace in the snapshot state.SV
- The type of the state value.public abstract class AbstractFsStateSnapshot<K,N,SV,S extends State,SD extends StateDescriptor<S,?>> extends AbstractFileStateHandle implements KvStateSnapshot<K,N,S,SD,FsStateBackend>
Modifier and Type | Field and Description |
---|---|
protected TypeSerializer<K> |
keySerializer
Key Serializer
|
protected TypeSerializer<N> |
namespaceSerializer
Namespace Serializer
|
protected SD |
stateDesc
StateDescriptor, for sanity checks
|
protected TypeSerializer<SV> |
stateSerializer
Serializer for the state value
|
Constructor and Description |
---|
AbstractFsStateSnapshot(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
TypeSerializer<SV> stateSerializer,
SD stateDesc,
Path filePath)
Creates a new state snapshot with data in the file system.
|
Modifier and Type | Method and Description |
---|---|
abstract KvState<K,N,S,SD,FsStateBackend> |
createFsState(FsStateBackend backend,
HashMap<N,Map<K,SV>> stateMap) |
long |
getStateSize()
Returns the file size in bytes.
|
KvState<K,N,S,SD,FsStateBackend> |
restoreState(FsStateBackend stateBackend,
TypeSerializer<K> keySerializer,
ClassLoader classLoader,
long recoveryTimestamp)
Loads the key/value state back from this snapshot.
|
discardState, getFilePath, getFileSize, getFileSystem
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
discardState
protected final TypeSerializer<K> keySerializer
protected final TypeSerializer<N> namespaceSerializer
protected final TypeSerializer<SV> stateSerializer
protected final SD extends StateDescriptor<S,?> stateDesc
public AbstractFsStateSnapshot(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, TypeSerializer<SV> stateSerializer, SD stateDesc, Path filePath)
keySerializer
- The serializer for the keys.namespaceSerializer
- The serializer for the namespace.stateSerializer
- The serializer for the elements in the state HashMapstateDesc
- The state identifierfilePath
- The path where the snapshot data is stored.public abstract KvState<K,N,S,SD,FsStateBackend> createFsState(FsStateBackend backend, HashMap<N,Map<K,SV>> stateMap)
public KvState<K,N,S,SD,FsStateBackend> restoreState(FsStateBackend stateBackend, TypeSerializer<K> keySerializer, ClassLoader classLoader, long recoveryTimestamp) throws Exception
KvStateSnapshot
restoreState
in interface KvStateSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>,FsStateBackend>
stateBackend
- The state backend that created this snapshot and can restore the key/value state
from this snapshot.keySerializer
- The serializer for the keys.classLoader
- The class loader for user-defined types.recoveryTimestamp
- The timestamp of the checkpoint we are recovering from.Exception
- Exceptions can occur during the state loading and are forwarded.public long getStateSize() throws IOException
getStateSize
in interface KvStateSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>,FsStateBackend>
IOException
- Thrown if the file system cannot be accessed.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.