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,V,ValueState<V>> implements InternalValueState<K,N,V>
ValueState
implementation that stores state in RocksDB.backend, columnFamily, defaultValue, keySerializationDataOutputView, keySerializationStream, writeOptions
Constructor and Description |
---|
RocksDBValueState(org.rocksdb.ColumnFamilyHandle columnFamily,
TypeSerializer<N> namespaceSerializer,
TypeSerializer<V> valueSerializer,
V defaultValue,
RocksDBKeyedStateBackend<K> backend)
Creates a new
RocksDBValueState . |
Modifier and Type | Method and Description |
---|---|
TypeSerializer<K> |
getKeySerializer()
Returns the
TypeSerializer for the type of key this state is associated to. |
TypeSerializer<N> |
getNamespaceSerializer()
Returns the
TypeSerializer for the type of namespace this state is associated to. |
TypeSerializer<V> |
getValueSerializer()
Returns the
TypeSerializer for the type of value this state holds. |
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, getDefaultValue, getSerializedValue, setCurrentNamespace, writeCurrentKeyWithGroupAndNamespace, writeKeyWithGroupAndNamespace, writeKeyWithGroupAndNamespace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSerializedValue, setCurrentNamespace
public RocksDBValueState(org.rocksdb.ColumnFamilyHandle columnFamily, TypeSerializer<N> namespaceSerializer, TypeSerializer<V> valueSerializer, V defaultValue, RocksDBKeyedStateBackend<K> backend)
RocksDBValueState
.columnFamily
- The RocksDB column family that this state is associated to.namespaceSerializer
- The serializer for the namespace.valueSerializer
- The serializer for the state.defaultValue
- The default value for the state.backend
- The backend for which this state is bind to.public TypeSerializer<K> getKeySerializer()
InternalKvState
TypeSerializer
for the type of key this state is associated to.getKeySerializer
in interface InternalKvState<K,N,V>
public TypeSerializer<N> getNamespaceSerializer()
InternalKvState
TypeSerializer
for the type of namespace this state is associated to.getNamespaceSerializer
in interface InternalKvState<K,N,V>
public TypeSerializer<V> getValueSerializer()
InternalKvState
TypeSerializer
for the type of value this state holds.getValueSerializer
in interface InternalKvState<K,N,V>
public V value()
ValueState
If you didn't specify a default value when creating the ValueStateDescriptor
this will return null
when to value was previously set using ValueState.update(Object)
.
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 ValueState<V>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.Copyright © 2014–2019 The Apache Software Foundation. All rights reserved.