K - The type of the key.N - The type of the namespace.UK - The type of the keys in the map state.UV - The type of the values in the map state.public class RocksDBMapState<K,N,UK,UV> extends AbstractRocksDBState<K,N,org.apache.flink.api.common.state.MapState<UK,UV>,org.apache.flink.api.common.state.MapStateDescriptor<UK,UV>,Map<UK,UV>> implements org.apache.flink.runtime.state.internal.InternalMapState<N,UK,UV>
MapState 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 |
|---|
RocksDBMapState(org.rocksdb.ColumnFamilyHandle columnFamily,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.MapStateDescriptor<UK,UV> stateDesc,
RocksDBKeyedStateBackend<K> backend)
Creates a new
RocksDBMapState. |
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
boolean |
contains(UK userKey) |
Iterable<Map.Entry<UK,UV>> |
entries() |
UV |
get(UK userKey) |
byte[] |
getSerializedValue(byte[] serializedKeyAndNamespace) |
Iterator<Map.Entry<UK,UV>> |
iterator() |
Iterable<UK> |
keys() |
void |
put(UK userKey,
UV userValue) |
void |
putAll(Map<UK,UV> map) |
void |
remove(UK userKey) |
Iterable<UV> |
values() |
readKeyWithGroupAndNamespace, setCurrentNamespace, writeCurrentKeyWithGroupAndNamespace, writeKeyWithGroupAndNamespacepublic RocksDBMapState(org.rocksdb.ColumnFamilyHandle columnFamily,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.state.MapStateDescriptor<UK,UV> stateDesc,
RocksDBKeyedStateBackend<K> backend)
RocksDBMapState.namespaceSerializer - The serializer for the namespace.stateDesc - The state identifier for the state.public UV get(UK userKey) throws IOException, org.rocksdb.RocksDBException
get in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic void put(UK userKey, UV userValue) throws IOException, org.rocksdb.RocksDBException
put in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic void putAll(Map<UK,UV> map) throws IOException, org.rocksdb.RocksDBException
putAll in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic void remove(UK userKey) throws IOException, org.rocksdb.RocksDBException
remove in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic boolean contains(UK userKey) throws IOException, org.rocksdb.RocksDBException
contains in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic Iterable<Map.Entry<UK,UV>> entries() throws IOException, org.rocksdb.RocksDBException
entries in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic Iterable<UK> keys() throws IOException, org.rocksdb.RocksDBException
keys in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic Iterable<UV> values() throws IOException, org.rocksdb.RocksDBException
values in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic Iterator<Map.Entry<UK,UV>> iterator() throws IOException, org.rocksdb.RocksDBException
iterator in interface org.apache.flink.api.common.state.MapState<UK,UV>IOExceptionorg.rocksdb.RocksDBExceptionpublic void clear()
public byte[] getSerializedValue(byte[] serializedKeyAndNamespace)
throws Exception
getSerializedValue in interface org.apache.flink.runtime.state.internal.InternalKvState<N>getSerializedValue in class AbstractRocksDBState<K,N,org.apache.flink.api.common.state.MapState<UK,UV>,org.apache.flink.api.common.state.MapStateDescriptor<UK,UV>,Map<UK,UV>>ExceptionCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.