K
- The type of the keyN
- The type of the namespaceS
- The type of the State
SD
- The type of the StateDescriptor
Backend
- The type of the backend that can restore the state from this snapshot.public interface KvStateSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>,Backend extends AbstractStateBackend> extends Serializable
KvState
, taken for a checkpoint. Where exactly
the snapshot stores the snapshot data (in this object, in an external data store, etc) depends
on the actual implementation. This snapshot defines merely how to restore the state and
how to discard the state.
One possible implementation is that this snapshot simply contains a copy of the key/value map.
Another possible implementation for this snapshot is that the key/value map is serialized into a file and this snapshot object contains a pointer to that file.
Modifier and Type | Method and Description |
---|---|
void |
discardState()
Discards the state snapshot, removing any resources occupied by it.
|
long |
getStateSize()
Returns the size of the state in bytes.
|
KvState<K,N,S,SD,Backend> |
restoreState(Backend stateBackend,
TypeSerializer<K> keySerializer,
ClassLoader classLoader,
long recoveryTimestamp)
Loads the key/value state back from this snapshot.
|
KvState<K,N,S,SD,Backend> restoreState(Backend stateBackend, TypeSerializer<K> keySerializer, ClassLoader classLoader, long recoveryTimestamp) throws Exception
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.void discardState() throws Exception
Exception
- Exceptions occurring during the state disposal should be forwarded.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.