Class ForStKeyedStateBackend<K>

  • All Implemented Interfaces:
    Closeable, AutoCloseable, org.apache.flink.runtime.state.AsyncKeyedStateBackend, org.apache.flink.util.Disposable

    public class ForStKeyedStateBackend<K>
    extends Object
    implements org.apache.flink.runtime.state.AsyncKeyedStateBackend
    A KeyedStateBackend that stores its state in ForSt. This state backend can store very large state that exceeds memory even disk to remote storage.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.rocksdb.RocksDB db
      Our ForSt database.
      protected org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer
      The key serializer.
    • Constructor Summary

      Constructors 
      Constructor Description
      ForStKeyedStateBackend​(ForStResourceContainer optionsContainer, org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer, java.util.function.Supplier<org.apache.flink.runtime.state.SerializedCompositeKeyBuilder<K>> serializedKeyBuilder, java.util.function.Supplier<org.apache.flink.core.memory.DataOutputSerializer> valueSerializerView, java.util.function.Supplier<org.apache.flink.core.memory.DataInputDeserializer> valueDeserializerView, org.rocksdb.RocksDB db, java.util.function.Function<String,​org.rocksdb.ColumnFamilyOptions> columnFamilyOptionsFactory, org.rocksdb.ColumnFamilyHandle defaultColumnFamilyHandle, ForStNativeMetricMonitor nativeMetricMonitor)  
    • Field Detail

      • keySerializer

        protected final org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer
        The key serializer.
      • db

        protected final org.rocksdb.RocksDB db
        Our ForSt database. The different k/v states that we have don't each have their own ForSt instance. They all write to this instance but to their own column family.
    • Constructor Detail

      • ForStKeyedStateBackend

        public ForStKeyedStateBackend​(ForStResourceContainer optionsContainer,
                                      org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
                                      java.util.function.Supplier<org.apache.flink.runtime.state.SerializedCompositeKeyBuilder<K>> serializedKeyBuilder,
                                      java.util.function.Supplier<org.apache.flink.core.memory.DataOutputSerializer> valueSerializerView,
                                      java.util.function.Supplier<org.apache.flink.core.memory.DataInputDeserializer> valueDeserializerView,
                                      org.rocksdb.RocksDB db,
                                      java.util.function.Function<String,​org.rocksdb.ColumnFamilyOptions> columnFamilyOptionsFactory,
                                      org.rocksdb.ColumnFamilyHandle defaultColumnFamilyHandle,
                                      ForStNativeMetricMonitor nativeMetricMonitor)
    • Method Detail

      • setup

        public void setup​(@Nonnull
                          org.apache.flink.runtime.asyncprocessing.StateRequestHandler stateRequestHandler)
        Specified by:
        setup in interface org.apache.flink.runtime.state.AsyncKeyedStateBackend
      • createState

        @Nonnull
        public <SV,​S extends org.apache.flink.api.common.state.v2.State> S createState​(@Nonnull
                                                                                             org.apache.flink.runtime.state.v2.StateDescriptor<SV> stateDesc)
        Specified by:
        createState in interface org.apache.flink.runtime.state.AsyncKeyedStateBackend
      • createStateExecutor

        @Nonnull
        public org.apache.flink.runtime.asyncprocessing.StateExecutor createStateExecutor()
        Specified by:
        createStateExecutor in interface org.apache.flink.runtime.state.AsyncKeyedStateBackend
      • dispose

        public void dispose()
        Should only be called by one thread, and only after all accesses to the DB happened.
        Specified by:
        dispose in interface org.apache.flink.runtime.state.AsyncKeyedStateBackend
        Specified by:
        dispose in interface org.apache.flink.util.Disposable