K - The type of the key.N - The type of the namespace.V - The type of values kept internally in state.S - The type of State.public abstract class AbstractRocksDBState<K,N,V,S extends org.apache.flink.api.common.state.State> extends Object implements org.apache.flink.runtime.state.internal.InternalKvState<K,N,V>, org.apache.flink.api.common.state.State
State implementations that store state in a RocksDB database.
State is not stored in this class but in the RocksDB instance that
the RocksDBStateBackend manages and checkpoints.
| Modifier and Type | Field and Description |
|---|---|
protected RocksDBKeyedStateBackend<K> |
backend
Backend that holds the actual RocksDB instance where we store state.
|
protected org.rocksdb.ColumnFamilyHandle |
columnFamily
The column family of this particular instance of state.
|
protected V |
defaultValue |
protected org.apache.flink.core.memory.DataOutputView |
keySerializationDataOutputView |
protected org.apache.flink.core.memory.ByteArrayOutputStreamWithPos |
keySerializationStream |
protected org.rocksdb.WriteOptions |
writeOptions |
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRocksDBState(org.rocksdb.ColumnFamilyHandle columnFamily,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer,
V defaultValue,
RocksDBKeyedStateBackend<K> backend)
Creates a new RocksDB backed state.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
protected V |
getDefaultValue() |
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<V> safeValueSerializer) |
void |
setCurrentNamespace(N namespace) |
protected void |
writeCurrentKeyWithGroupAndNamespace() |
protected void |
writeKeyWithGroupAndNamespace(int keyGroup,
K key,
N namespace,
org.apache.flink.core.memory.ByteArrayOutputStreamWithPos keySerializationStream,
org.apache.flink.core.memory.DataOutputView keySerializationDataOutputView) |
protected void |
writeKeyWithGroupAndNamespace(int keyGroup,
K key,
org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
N namespace,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.core.memory.ByteArrayOutputStreamWithPos keySerializationStream,
org.apache.flink.core.memory.DataOutputView keySerializationDataOutputView) |
protected RocksDBKeyedStateBackend<K> backend
protected org.rocksdb.ColumnFamilyHandle columnFamily
protected final V defaultValue
protected final org.rocksdb.WriteOptions writeOptions
protected final org.apache.flink.core.memory.ByteArrayOutputStreamWithPos keySerializationStream
protected final org.apache.flink.core.memory.DataOutputView keySerializationDataOutputView
protected AbstractRocksDBState(org.rocksdb.ColumnFamilyHandle columnFamily,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer,
V defaultValue,
RocksDBKeyedStateBackend<K> backend)
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 void clear()
clear in interface org.apache.flink.api.common.state.Statepublic void setCurrentNamespace(N namespace)
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<V> safeValueSerializer)
throws Exception
protected void writeCurrentKeyWithGroupAndNamespace()
throws IOException
IOExceptionprotected void writeKeyWithGroupAndNamespace(int keyGroup,
K key,
N namespace,
org.apache.flink.core.memory.ByteArrayOutputStreamWithPos keySerializationStream,
org.apache.flink.core.memory.DataOutputView keySerializationDataOutputView)
throws IOException
IOExceptionprotected void writeKeyWithGroupAndNamespace(int keyGroup,
K key,
org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
N namespace,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
org.apache.flink.core.memory.ByteArrayOutputStreamWithPos keySerializationStream,
org.apache.flink.core.memory.DataOutputView keySerializationDataOutputView)
throws IOException
IOExceptionprotected V getDefaultValue()
Copyright © 2014–2018 The Apache Software Foundation. All rights reserved.