K
- The type of the key.N
- The type of the namespace.V
- The type of value that the state state stores.public class RocksDBReducingState<K,N,V> extends AbstractRocksDBState<K,N,ReducingState<V>,ReducingStateDescriptor<V>,V> implements InternalReducingState<N,V>
ReducingState
implementation that stores state in RocksDB.backend, columnFamily, keySerializationDataOutputView, keySerializationStream, stateDesc
Constructor and Description |
---|
RocksDBReducingState(org.rocksdb.ColumnFamilyHandle columnFamily,
TypeSerializer<N> namespaceSerializer,
ReducingStateDescriptor<V> stateDesc,
RocksDBKeyedStateBackend<K> backend)
Creates a new
RocksDBReducingState . |
Modifier and Type | Method and Description |
---|---|
void |
add(V value)
Updates the operator state accessible by
AppendingState.get() by adding the given value
to the list of values. |
V |
get()
Returns the current value for the state.
|
void |
mergeNamespaces(N target,
Collection<N> sources)
Merges the state of the current key for the given source namespaces into the state of
the target namespace.
|
clear, getSerializedValue, readKeyWithGroupAndNamespace, setCurrentNamespace, writeCurrentKeyWithGroupAndNamespace, writeKeyWithGroupAndNamespace
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getSerializedValue, setCurrentNamespace
public RocksDBReducingState(org.rocksdb.ColumnFamilyHandle columnFamily, TypeSerializer<N> namespaceSerializer, ReducingStateDescriptor<V> stateDesc, RocksDBKeyedStateBackend<K> backend)
RocksDBReducingState
.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.public V get()
AppendingState
NOTE TO IMPLEMENTERS: if the state is empty, then this method
should return null
.
get
in interface AppendingState<V,V>
null
if the state is empty.public void add(V value) throws IOException
AppendingState
AppendingState.get()
by adding the given value
to the list of values. The next time AppendingState.get()
is called (for the same state
partition) the returned state will represent the updated list.add
in interface AppendingState<V,V>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.public void mergeNamespaces(N target, Collection<N> sources) throws Exception
InternalMergingState
mergeNamespaces
in interface InternalMergingState<N,V,V>
target
- The target namespace where the merged state should be stored.sources
- The source namespaces whose state should be merged.Exception
- The method may forward exception thrown internally (by I/O or functions).Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.