Class AbstractForStSyncState<K,N,V>
java.lang.Object
org.apache.flink.state.forst.sync.AbstractForStSyncState<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 AbstractForStSyncState<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 for
State implementations that store state in a RocksDB database.
State is not stored in this class but in the RocksDB instance that the
ForStStateBackend manages and checkpoints.
-
Nested Class Summary
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ForStSyncKeyedStateBackend<K>Backend that holds the actual RocksDB instance where we store state.protected org.forstdb.ColumnFamilyHandleThe column family of this particular instance of state.protected final org.apache.flink.core.memory.DataInputDeserializerprotected final org.apache.flink.core.memory.DataOutputSerializerprotected Vprotected final org.forstdb.WriteOptions -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractForStSyncState(org.forstdb.ColumnFamilyHandle columnFamily, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer, V defaultValue, ForStSyncKeyedStateBackend<K> backend) Creates a new RocksDB backed state. -
Method Summary
Modifier and TypeMethodDescriptionvoidclear()protected Vbyte[]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) 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 AbstractForStSyncState<K,N, V> setDefaultValue(V defaultValue) protected AbstractForStSyncState<K,N, V> setNamespaceSerializer(org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer) protected AbstractForStSyncState<K,N, V> setValueSerializer(org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.apache.flink.runtime.state.internal.InternalKvState
getKeySerializer, getNamespaceSerializer, getValueSerializer
-
Field Details
-
backend
Backend that holds the actual RocksDB instance where we store state. -
columnFamily
protected org.forstdb.ColumnFamilyHandle columnFamilyThe column family of this particular instance of state. -
defaultValue
-
writeOptions
protected final org.forstdb.WriteOptions writeOptions -
dataOutputView
protected final org.apache.flink.core.memory.DataOutputSerializer dataOutputView -
dataInputView
protected final org.apache.flink.core.memory.DataInputDeserializer dataInputView
-
-
Constructor Details
-
AbstractForStSyncState
protected AbstractForStSyncState(org.forstdb.ColumnFamilyHandle columnFamily, org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer, org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer, V defaultValue, ForStSyncKeyedStateBackend<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 Details
-
clear
public void clear()- Specified by:
clearin interfaceorg.apache.flink.api.common.state.State
-
setCurrentNamespace
-
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
-
setNamespaceSerializer
protected AbstractForStSyncState<K,N, setNamespaceSerializerV> (org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer) -
setValueSerializer
protected AbstractForStSyncState<K,N, setValueSerializerV> (org.apache.flink.api.common.typeutils.TypeSerializer<V> valueSerializer) -
setDefaultValue
-
getStateIncrementalVisitor
-