K
- The type of the key.N
- The type of the namespace.S
- The type of State
.SD
- The type of StateDescriptor
.public abstract class AbstractRocksDBState<K,N,S extends State,SD extends StateDescriptor<S,?>> extends Object implements KvState<K,N,S,SD,RocksDBStateBackend>, State
State
implementations that store state in a RocksDB database.
State is not stored in this class but in the RocksDB
instance that
the RocksDBStateBackend
manages and checkpoints.
Modifier and Type | Field and Description |
---|---|
protected RocksDBStateBackend |
backend
Backend that holds the actual RocksDB instance where we store state
|
protected org.rocksdb.ColumnFamilyHandle |
columnFamily
The column family of this particular instance of state
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractRocksDBState(org.rocksdb.ColumnFamilyHandle columnFamily,
TypeSerializer<N> namespaceSerializer,
RocksDBStateBackend backend)
Creates a new RocksDB backed state.
|
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes the value mapped under the current key.
|
void |
dispose()
Disposes the key/value state, releasing all occupied resources.
|
void |
setCurrentKey(K key)
Sets the current key, which will be used when using the state access methods.
|
void |
setCurrentNamespace(N namespace)
Sets the current namespace, which will be used when using the state access methods.
|
KvStateSnapshot<K,N,S,SD,RocksDBStateBackend> |
snapshot(long checkpointId,
long timestamp)
Creates a snapshot of this state.
|
protected void |
writeKeyAndNamespace(DataOutputView out) |
protected RocksDBStateBackend backend
protected org.rocksdb.ColumnFamilyHandle columnFamily
protected AbstractRocksDBState(org.rocksdb.ColumnFamilyHandle columnFamily, TypeSerializer<N> namespaceSerializer, RocksDBStateBackend backend)
namespaceSerializer
- The serializer for the namespace.public void clear()
State
protected void writeKeyAndNamespace(DataOutputView out) throws IOException
IOException
public void setCurrentNamespace(N namespace)
KvState
setCurrentNamespace
in interface KvState<K,N,S extends State,SD extends StateDescriptor<S,?>,RocksDBStateBackend>
namespace
- The namespace.public void dispose()
KvState
dispose
in interface KvState<K,N,S extends State,SD extends StateDescriptor<S,?>,RocksDBStateBackend>
public void setCurrentKey(K key)
KvState
setCurrentKey
in interface KvState<K,N,S extends State,SD extends StateDescriptor<S,?>,RocksDBStateBackend>
key
- The key.public KvStateSnapshot<K,N,S,SD,RocksDBStateBackend> snapshot(long checkpointId, long timestamp) throws Exception
KvState
snapshot
in interface KvState<K,N,S extends State,SD extends StateDescriptor<S,?>,RocksDBStateBackend>
checkpointId
- The ID of the checkpoint for which the snapshot should be created.timestamp
- The timestamp of the checkpoint.Exception
- Exceptions during snapshotting the state should be forwarded, so the system
can react to failed snapshots.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.