protected abstract static class AbstractRocksDBState.AbstractRocksDBSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>> extends Object implements KvStateSnapshot<K,N,S,SD,RocksDBStateBackend>
Modifier and Type | Field and Description |
---|---|
protected URI |
backupUri |
protected File |
basePath
Store it so that we can clean up in dispose()
|
protected long |
checkpointId |
protected String |
checkpointPath
Where we should put RocksDB backups
|
protected TypeSerializer<K> |
keySerializer
Key serializer
|
protected TypeSerializer<N> |
namespaceSerializer
Namespace serializer
|
protected SD |
stateDesc
Hash of the StateDescriptor, for sanity checks
|
Constructor and Description |
---|
AbstractRocksDBSnapshot(File basePath,
String checkpointPath,
URI backupUri,
long checkpointId,
TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
SD stateDesc)
Creates a new snapshot from the given state parameters.
|
Modifier and Type | Method and Description |
---|---|
protected abstract KvState<K,N,S,SD,RocksDBStateBackend> |
createRocksDBState(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
SD stateDesc,
File basePath,
String backupPath,
String restorePath,
org.rocksdb.Options options)
Subclasses must implement this for creating a concrete RocksDB state.
|
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,RocksDBStateBackend> |
restoreState(RocksDBStateBackend stateBackend,
TypeSerializer<K> keySerializer,
ClassLoader classLoader,
long recoveryTimestamp)
Loads the key/value state back from this snapshot.
|
protected final File basePath
protected final String checkpointPath
protected final URI backupUri
protected long checkpointId
protected final TypeSerializer<K> keySerializer
protected final TypeSerializer<N> namespaceSerializer
protected final SD extends StateDescriptor<S,?> stateDesc
public AbstractRocksDBSnapshot(File basePath, String checkpointPath, URI backupUri, long checkpointId, TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, SD stateDesc)
protected abstract KvState<K,N,S,SD,RocksDBStateBackend> createRocksDBState(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, SD stateDesc, File basePath, String backupPath, String restorePath, org.rocksdb.Options options) throws Exception
Exception
public final KvState<K,N,S,SD,RocksDBStateBackend> restoreState(RocksDBStateBackend stateBackend, TypeSerializer<K> keySerializer, ClassLoader classLoader, long recoveryTimestamp) throws Exception
KvStateSnapshot
restoreState
in interface KvStateSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>,RocksDBStateBackend>
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 final void discardState() throws Exception
KvStateSnapshot
discardState
in interface KvStateSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>,RocksDBStateBackend>
Exception
- Exceptions occurring during the state disposal should be forwarded.public final long getStateSize() throws Exception
KvStateSnapshot
If the the size is not known, return 0
.
getStateSize
in interface KvStateSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>,RocksDBStateBackend>
Exception
- If the operation fails during size retrieval.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.