Class ForStMapState<K,​N,​UK,​UV>

  • Type Parameters:
    K - The type of the key.
    N - The type of the namespace.
    UK - The type of the user key.
    UV - The type of the user value.
    All Implemented Interfaces:
    org.apache.flink.api.common.state.v2.MapState<UK,​UV>, org.apache.flink.api.common.state.v2.State, org.apache.flink.runtime.state.v2.internal.InternalKeyedState<K,​N,​UV>, org.apache.flink.runtime.state.v2.internal.InternalMapState<K,​N,​UK,​UV>, org.apache.flink.runtime.state.v2.internal.InternalPartitionedState<N>, ForStInnerTable<K,​N,​UV>

    public class ForStMapState<K,​N,​UK,​UV>
    extends org.apache.flink.runtime.state.v2.AbstractMapState<K,​N,​UK,​UV>
    implements org.apache.flink.api.common.state.v2.MapState<UK,​UV>, ForStInnerTable<K,​N,​UV>
    The AbstractMapState implement for ForStDB.
    • Field Summary

      • Fields inherited from class org.apache.flink.runtime.state.v2.AbstractKeyedState

        stateRequestHandler
    • Constructor Summary

      Constructors 
      Constructor Description
      ForStMapState​(org.apache.flink.runtime.asyncprocessing.StateRequestHandler stateRequestHandler, org.forstdb.ColumnFamilyHandle columnFamily, org.apache.flink.api.common.state.v2.MapStateDescriptor<UK,​UV> stateDescriptor, Supplier<org.apache.flink.runtime.state.SerializedCompositeKeyBuilder<K>> serializedKeyBuilderInitializer, N defaultNamespace, Supplier<org.apache.flink.api.common.typeutils.TypeSerializer<N>> namespaceSerializerInitializer, Supplier<org.apache.flink.core.memory.DataOutputSerializer> valueSerializerViewInitializer, Supplier<org.apache.flink.core.memory.DataInputDeserializer> keyDeserializerViewInitializer, Supplier<org.apache.flink.core.memory.DataInputDeserializer> valueDeserializerViewInitializer, int keyGroupPrefixBytes)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      ForStDBBunchPutRequest<K,​N,​UK,​UV> buildDBBunchPutRequest​(org.apache.flink.runtime.asyncprocessing.StateRequest<?,​?,​?,​?> stateRequest)
      Build a request for bunch put.
      ForStDBGetRequest<?,​?,​?,​?> buildDBGetRequest​(org.apache.flink.runtime.asyncprocessing.StateRequest<?,​?,​?,​?> stateRequest)
      Build a ForStDBGetRequest that belong to this ForStInnerTable with the given stateRequest.
      ForStDBIterRequest<K,​N,​UK,​UV,​?> buildDBIterRequest​(org.apache.flink.runtime.asyncprocessing.StateRequest<?,​?,​?,​?> stateRequest)
      Build a request for iterator.
      ForStDBPutRequest<K,​N,​UV> buildDBPutRequest​(org.apache.flink.runtime.asyncprocessing.StateRequest<?,​?,​?,​?> stateRequest)
      Build a ForStDBPutRequest that belong to ForStInnerTable with the given stateRequest.
      UK deserializeUserKey​(byte[] userKeyBytes, int userKeyOffset)  
      UV deserializeValue​(byte[] valueBytes)
      Deserialize the given bytes value to POJO value.
      org.forstdb.ColumnFamilyHandle getColumnFamilyHandle()
      Get the columnFamily handle corresponding to table.
      int getKeyGroupPrefixBytes()  
      byte[] serializeKey​(ContextKey<K,​N> contextKey)
      Serialize the given key to bytes.
      byte[] serializeValue​(UV value)
      Serialize the given value to the outputView.
      • Methods inherited from class org.apache.flink.runtime.state.v2.AbstractMapState

        asyncContains, asyncEntries, asyncGet, asyncIsEmpty, asyncKeys, asyncPut, asyncPutAll, asyncRemove, asyncValues, contains, entries, get, isEmpty, iterator, keys, put, putAll, remove, values
      • Methods inherited from class org.apache.flink.runtime.state.v2.AbstractKeyedState

        asyncClear, clear, getStateDescriptor, getStateRequestHandler, getValueSerializer, handleRequest, handleRequestSync, setCurrentNamespace
      • Methods inherited from interface org.apache.flink.runtime.state.v2.internal.InternalPartitionedState

        setCurrentNamespace
      • Methods inherited from interface org.apache.flink.api.common.state.v2.MapState

        asyncContains, asyncEntries, asyncGet, asyncIsEmpty, asyncKeys, asyncPut, asyncPutAll, asyncRemove, asyncValues, contains, entries, get, isEmpty, iterator, keys, put, putAll, remove, values
      • Methods inherited from interface org.apache.flink.api.common.state.v2.State

        asyncClear, clear
    • Constructor Detail

      • ForStMapState

        public ForStMapState​(org.apache.flink.runtime.asyncprocessing.StateRequestHandler stateRequestHandler,
                             org.forstdb.ColumnFamilyHandle columnFamily,
                             org.apache.flink.api.common.state.v2.MapStateDescriptor<UK,​UV> stateDescriptor,
                             Supplier<org.apache.flink.runtime.state.SerializedCompositeKeyBuilder<K>> serializedKeyBuilderInitializer,
                             N defaultNamespace,
                             Supplier<org.apache.flink.api.common.typeutils.TypeSerializer<N>> namespaceSerializerInitializer,
                             Supplier<org.apache.flink.core.memory.DataOutputSerializer> valueSerializerViewInitializer,
                             Supplier<org.apache.flink.core.memory.DataInputDeserializer> keyDeserializerViewInitializer,
                             Supplier<org.apache.flink.core.memory.DataInputDeserializer> valueDeserializerViewInitializer,
                             int keyGroupPrefixBytes)
    • Method Detail

      • getKeyGroupPrefixBytes

        public int getKeyGroupPrefixBytes()
      • serializeKey

        public byte[] serializeKey​(ContextKey<K,​N> contextKey)
                            throws IOException
        Description copied from interface: ForStInnerTable
        Serialize the given key to bytes.
        Specified by:
        serializeKey in interface ForStInnerTable<K,​N,​UK>
        Parameters:
        contextKey - the key to be serialized.
        Returns:
        the key bytes
        Throws:
        IOException - Thrown if the serialization encountered an I/O related error.
      • serializeValue

        public byte[] serializeValue​(UV value)
                              throws IOException
        Description copied from interface: ForStInnerTable
        Serialize the given value to the outputView.
        Specified by:
        serializeValue in interface ForStInnerTable<K,​N,​UK>
        Parameters:
        value - the value to be serialized.
        Returns:
        the value bytes
        Throws:
        IOException - Thrown if the serialization encountered an I/O related error.
      • deserializeValue

        public UV deserializeValue​(byte[] valueBytes)
                            throws IOException
        Description copied from interface: ForStInnerTable
        Deserialize the given bytes value to POJO value.
        Specified by:
        deserializeValue in interface ForStInnerTable<K,​N,​UK>
        Parameters:
        valueBytes - the value bytes to be deserialized.
        Returns:
        the deserialized POJO value
        Throws:
        IOException - Thrown if the deserialization encountered an I/O related error.
      • deserializeUserKey

        public UK deserializeUserKey​(byte[] userKeyBytes,
                                     int userKeyOffset)
                              throws IOException
        Throws:
        IOException
      • buildDBGetRequest

        public ForStDBGetRequest<?,​?,​?,​?> buildDBGetRequest​(org.apache.flink.runtime.asyncprocessing.StateRequest<?,​?,​?,​?> stateRequest)
        Description copied from interface: ForStInnerTable
        Build a ForStDBGetRequest that belong to this ForStInnerTable with the given stateRequest.
        Specified by:
        buildDBGetRequest in interface ForStInnerTable<K,​N,​UK>
        Parameters:
        stateRequest - The given stateRequest.
        Returns:
        The corresponding ForSt GetRequest.
      • buildDBPutRequest

        public ForStDBPutRequest<K,​N,​UV> buildDBPutRequest​(org.apache.flink.runtime.asyncprocessing.StateRequest<?,​?,​?,​?> stateRequest)
        Description copied from interface: ForStInnerTable
        Build a ForStDBPutRequest that belong to ForStInnerTable with the given stateRequest.
        Specified by:
        buildDBPutRequest in interface ForStInnerTable<K,​N,​UK>
        Parameters:
        stateRequest - The given stateRequest.
        Returns:
        The corresponding ForSt PutRequest.
      • buildDBBunchPutRequest

        public ForStDBBunchPutRequest<K,​N,​UK,​UV> buildDBBunchPutRequest​(org.apache.flink.runtime.asyncprocessing.StateRequest<?,​?,​?,​?> stateRequest)
        Build a request for bunch put. Maily used for StateRequestType.MAP_PUT_ALL and StateRequestType.CLEAR.
        Parameters:
        stateRequest - The state request.
        Returns:
        The ForStDBBunchPutRequest.
      • buildDBIterRequest

        public ForStDBIterRequest<K,​N,​UK,​UV,​?> buildDBIterRequest​(org.apache.flink.runtime.asyncprocessing.StateRequest<?,​?,​?,​?> stateRequest)
        Build a request for iterator. Used for StateRequestType.MAP_ITER, StateRequestType.MAP_ITER_KEY, StateRequestType.MAP_ITER_VALUE and StateRequestType.ITERATOR_LOADING.
        Parameters:
        stateRequest - The state request.
        Returns:
        The ForStDBIterRequest.