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,Map<UK,UV>,org.apache.flink.api.common.state.MapState<UK,UV>> implements org.apache.flink.runtime.state.internal.InternalMapState<K,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, defaultValue, keySerializationDataOutputView, keySerializationStream, writeOptions| Constructor and Description |
|---|
RocksDBMapState(org.rocksdb.ColumnFamilyHandle columnFamily,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> valueSerializer,
Map<UK,UV> defaultValue,
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) |
org.apache.flink.api.common.typeutils.TypeSerializer<K> |
getKeySerializer() |
org.apache.flink.api.common.typeutils.TypeSerializer<N> |
getNamespaceSerializer() |
byte[] |
getSerializedValue(byte[] serializedKeyAndNamespace,
org.apache.flink.api.common.typeutils.TypeSerializer<K> safeKeySerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<N> safeNamespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> safeValueSerializer) |
org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> |
getValueSerializer() |
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() |
getDefaultValue, setCurrentNamespace, writeCurrentKeyWithGroupAndNamespace, writeKeyWithGroupAndNamespace, writeKeyWithGroupAndNamespacepublic RocksDBMapState(org.rocksdb.ColumnFamilyHandle columnFamily,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> valueSerializer,
Map<UK,UV> defaultValue,
RocksDBKeyedStateBackend<K> backend)
RocksDBMapState.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 org.apache.flink.api.common.typeutils.TypeSerializer<K> getKeySerializer()
public org.apache.flink.api.common.typeutils.TypeSerializer<N> getNamespaceSerializer()
public org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> getValueSerializer()
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,
org.apache.flink.api.common.typeutils.TypeSerializer<K> safeKeySerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<N> safeNamespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<Map<UK,UV>> safeValueSerializer)
throws Exception
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.