K
- The type of the key.N
- The type of the namespace.V
- The type of value that the state state stores.public class RocksDBValueState<K,N,V> extends AbstractRocksDBState<K,N,ValueState<V>,ValueStateDescriptor<V>> implements ValueState<V>
ValueState
implementation that stores state in RocksDB.AbstractRocksDBState.AbstractRocksDBSnapshot<K,N,S extends State,SD extends StateDescriptor<S,?>>
Modifier and Type | Field and Description |
---|---|
protected ValueStateDescriptor<V> |
stateDesc
This holds the name of the state and can create an initial default value for the state.
|
protected org.rocksdb.WriteOptions |
writeOptions
We disable writes to the write-ahead-log here.
|
basePath, checkpointPath, currentKey, currentNamespace, db, keySerializer, namespaceSerializer, rocksDbPath
Modifier | Constructor and Description |
---|---|
protected |
RocksDBValueState(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ValueStateDescriptor<V> stateDesc,
File dbPath,
String backupPath,
org.rocksdb.Options options)
Creates a new
RocksDBValueState . |
protected |
RocksDBValueState(TypeSerializer<K> keySerializer,
TypeSerializer<N> namespaceSerializer,
ValueStateDescriptor<V> stateDesc,
File dbPath,
String backupPath,
String restorePath,
org.rocksdb.Options options)
Creates a
RocksDBValueState by restoring from a directory. |
Modifier and Type | Method and Description |
---|---|
protected AbstractRocksDBState.AbstractRocksDBSnapshot<K,N,ValueState<V>,ValueStateDescriptor<V>> |
createRocksDBSnapshot(URI backupUri,
long checkpointId) |
void |
update(V value)
Updates the operator state accessible by
ValueState.value() to the given
value. |
V |
value()
Returns the current value for the state.
|
clear, dispose, setCurrentKey, setCurrentNamespace, snapshot, writeKeyAndNamespace
protected final ValueStateDescriptor<V> stateDesc
protected final org.rocksdb.WriteOptions writeOptions
protected RocksDBValueState(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ValueStateDescriptor<V> stateDesc, File dbPath, String backupPath, org.rocksdb.Options options)
RocksDBValueState
.keySerializer
- The serializer for the keys.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.dbPath
- The path on the local system where RocksDB data should be stored.backupPath
- The path where to store backups.protected RocksDBValueState(TypeSerializer<K> keySerializer, TypeSerializer<N> namespaceSerializer, ValueStateDescriptor<V> stateDesc, File dbPath, String backupPath, String restorePath, org.rocksdb.Options options)
RocksDBValueState
by restoring from a directory.keySerializer
- The serializer for the keys.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.dbPath
- The path on the local system where RocksDB data should be stored.backupPath
- The path where to store backups.restorePath
- The path on the local file system that we are restoring from.public V value()
ValueState
value
in interface OperatorState<V>
value
in interface ValueState<V>
public void update(V value) throws IOException
ValueState
ValueState.value()
to the given
value. The next time ValueState.value()
is called (for the same state
partition) the returned state will represent the updated value. When a
partitioned state is updated with null, the state for the current key
will be removed and the default value is returned on the next access.update
in interface OperatorState<V>
update
in interface ValueState<V>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.protected AbstractRocksDBState.AbstractRocksDBSnapshot<K,N,ValueState<V>,ValueStateDescriptor<V>> createRocksDBSnapshot(URI backupUri, long checkpointId)
createRocksDBSnapshot
in class AbstractRocksDBState<K,N,ValueState<V>,ValueStateDescriptor<V>>
Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.