Package org.apache.flink.state.rocksdb
Class AbstractRocksDBState<K,N,V>
- java.lang.Object
-
- org.apache.flink.state.rocksdb.AbstractRocksDBState<K,N,V>
-
- Type Parameters:
K- The type of the key.N- The type of the namespace.V- The type of values kept internally in state.
- All Implemented Interfaces:
org.apache.flink.api.common.state.State,org.apache.flink.runtime.state.internal.InternalKvState<K,N,V>
public abstract class AbstractRocksDBState<K,N,V> extends Object implements org.apache.flink.runtime.state.internal.InternalKvState<K,N,V>, org.apache.flink.api.common.state.State
Base class forStateimplementations that store state in a RocksDB database.State is not stored in this class but in the
RocksDBinstance that theEmbeddedRocksDBStateBackendmanages and checkpoints.
-
-
Field Summary
Fields Modifier and Type Field Description protected RocksDBKeyedStateBackend<K>backendBackend that holds the actual RocksDB instance where we store state.protected org.rocksdb.ColumnFamilyHandlecolumnFamilyThe column family of this particular instance of state.protected org.apache.flink.core.memory.DataInputDeserializerdataInputViewprotected org.apache.flink.core.memory.DataOutputSerializerdataOutputViewprotected VdefaultValueprotected org.rocksdb.WriteOptionswriteOptions
-
Constructor Summary
Constructors Modifier Constructor Description protectedAbstractRocksDBState(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.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclear()protected VgetDefaultValue()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)org.apache.flink.runtime.state.internal.InternalKvState.StateIncrementalVisitor<K,N,V>getStateIncrementalVisitor(int recommendedMaxNumberOfReturnedRecords)voidmigrateSerializedValue(org.apache.flink.core.memory.DataInputDeserializer serializedOldValueInput, org.apache.flink.core.memory.DataOutputSerializer serializedMigratedValueOutput, org.apache.flink.api.common.typeutils.TypeSerializer<V> priorSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<V> newSerializer)voidsetCurrentNamespace(N namespace)protected AbstractRocksDBState<K,N,V>setDefaultValue(V defaultValue)protected AbstractRocksDBState<K,N,V>setNamespaceSerializer(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer)protected AbstractRocksDBState<K,N,V>setValueSerializer(org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)
-
-
-
Field Detail
-
backend
protected RocksDBKeyedStateBackend<K> backend
Backend that holds the actual RocksDB instance where we store state.
-
columnFamily
protected org.rocksdb.ColumnFamilyHandle columnFamily
The column family of this particular instance of state.
-
defaultValue
protected V defaultValue
-
writeOptions
protected final org.rocksdb.WriteOptions writeOptions
-
dataOutputView
protected final org.apache.flink.core.memory.DataOutputSerializer dataOutputView
-
dataInputView
protected final org.apache.flink.core.memory.DataInputDeserializer dataInputView
-
-
Constructor Detail
-
AbstractRocksDBState
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.- Parameters:
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.
-
-
Method Detail
-
clear
public void clear()
- Specified by:
clearin interfaceorg.apache.flink.api.common.state.State
-
setCurrentNamespace
public void setCurrentNamespace(N namespace)
-
getSerializedValue
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
-
migrateSerializedValue
public void migrateSerializedValue(org.apache.flink.core.memory.DataInputDeserializer serializedOldValueInput, org.apache.flink.core.memory.DataOutputSerializer serializedMigratedValueOutput, org.apache.flink.api.common.typeutils.TypeSerializer<V> priorSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<V> newSerializer) throws org.apache.flink.util.StateMigrationException- Throws:
org.apache.flink.util.StateMigrationException
-
getDefaultValue
protected V getDefaultValue()
-
setNamespaceSerializer
protected AbstractRocksDBState<K,N,V> setNamespaceSerializer(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer)
-
setValueSerializer
protected AbstractRocksDBState<K,N,V> setValueSerializer(org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer)
-
setDefaultValue
protected AbstractRocksDBState<K,N,V> setDefaultValue(V defaultValue)
-
-