K
- The type of the key.N
- The type of the namespace.V
- The type of the values in the list state.public class RocksDBListState<K,N,V> extends AbstractRocksDBState<K,N,ListState<V>,ListStateDescriptor<V>,V> implements ListState<V>
ListState
implementation that stores state in RocksDB.
RocksDBStateBackend
must ensure that we set the
StringAppendOperator
on the column family that we use for our state since
we use the merge()
call.
backend, columnFamily, keySerializationDataOutputView, keySerializationStream, stateDesc
Constructor and Description |
---|
RocksDBListState(org.rocksdb.ColumnFamilyHandle columnFamily,
TypeSerializer<N> namespaceSerializer,
ListStateDescriptor<V> stateDesc,
RocksDBKeyedStateBackend<K> backend)
Creates a new
RocksDBListState . |
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. |
Iterable<V> |
get()
Returns the current value for the state.
|
clear, getSerializedValue, setCurrentNamespace, writeCurrentKeyWithGroupAndNamespace, writeKeyWithGroupAndNamespace
public RocksDBListState(org.rocksdb.ColumnFamilyHandle columnFamily, TypeSerializer<N> namespaceSerializer, ListStateDescriptor<V> stateDesc, RocksDBKeyedStateBackend<K> backend)
RocksDBListState
.namespaceSerializer
- The serializer for the namespace.stateDesc
- The state identifier for the state. This contains name
and can create a default state value.public Iterable<V> get()
AppendingState
NOTE TO IMPLEMENTERS: if the state is empty, then this method
should return null
.
get
in interface AppendingState<V,Iterable<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,Iterable<V>>
value
- The new value for the state.IOException
- Thrown if the system cannot access the state.Copyright © 2014–2017 The Apache Software Foundation. All rights reserved.