K - The type of the key.N - The type of the namespace.S - The type of State.SD - The type of StateDescriptor.public abstract class AbstractRocksDBState<K,N,S extends org.apache.flink.api.common.state.State,SD extends org.apache.flink.api.common.state.StateDescriptor<S,V>,V> extends Object implements org.apache.flink.runtime.state.KvState<N>, 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 org.apache.flink.core.memory.DataOutputView |
keySerializationDataOutputView |
protected org.apache.flink.core.memory.ByteArrayOutputStreamWithPos |
keySerializationStream |
protected SD |
stateDesc
State descriptor from which to create this state instance
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractRocksDBState(org.rocksdb.ColumnFamilyHandle columnFamily,
org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
SD stateDesc,
RocksDBKeyedStateBackend<K> backend)
Creates a new RocksDB backed state.
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear() |
byte[] |
getSerializedValue(byte[] serializedKeyAndNamespace) |
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 RocksDBKeyedStateBackend<K> backend
protected org.rocksdb.ColumnFamilyHandle columnFamily
protected final SD extends org.apache.flink.api.common.state.StateDescriptor<S,V> stateDesc
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,
SD stateDesc,
RocksDBKeyedStateBackend<K> backend)
namespaceSerializer - The serializer for the namespace.public void clear()
clear in interface org.apache.flink.api.common.state.Statepublic void setCurrentNamespace(N namespace)
setCurrentNamespace in interface org.apache.flink.runtime.state.KvState<N>public byte[] getSerializedValue(byte[] serializedKeyAndNamespace)
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
IOExceptionCopyright © 2014–2017 The Apache Software Foundation. All rights reserved.