Class CopyOnWriteSkipListStateMap<K,​N,​S>

  • Type Parameters:
    K - type of key
    N - type of namespace
    S - type of state
    All Implemented Interfaces:
    AutoCloseable, Iterable<org.apache.flink.runtime.state.StateEntry<K,​N,​S>>

    public final class CopyOnWriteSkipListStateMap<K,​N,​S>
    extends org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
    implements AutoCloseable
    Implementation of state map which is based on skip list with copy-on-write support. states will be serialized to bytes and stored in the space allocated with the given allocator.
    • Constructor Detail

      • CopyOnWriteSkipListStateMap

        public CopyOnWriteSkipListStateMap​(@Nonnull
                                           org.apache.flink.api.common.typeutils.TypeSerializer<K> keySerializer,
                                           @Nonnull
                                           org.apache.flink.api.common.typeutils.TypeSerializer<N> namespaceSerializer,
                                           @Nonnull
                                           org.apache.flink.api.common.typeutils.TypeSerializer<S> stateSerializer,
                                           @Nonnull
                                           Allocator spaceAllocator,
                                           int numKeysToDeleteOneTime,
                                           float logicalRemovedKeysRatio)
    • Method Detail

      • size

        public int size()
        Specified by:
        size in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • getRequestCount

        public int getRequestCount()
      • get

        public S get​(K key,
                     N namespace)
        Specified by:
        get in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • containsKey

        public boolean containsKey​(K key,
                                   N namespace)
        Specified by:
        containsKey in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • put

        public void put​(K key,
                        N namespace,
                        S state)
        Specified by:
        put in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • putAndGetOld

        public S putAndGetOld​(K key,
                              N namespace,
                              S state)
        Specified by:
        putAndGetOld in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • remove

        public void remove​(K key,
                           N namespace)
        Specified by:
        remove in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • removeAndGetOld

        public S removeAndGetOld​(K key,
                                 N namespace)
        Specified by:
        removeAndGetOld in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • transform

        public <T> void transform​(K key,
                                  N namespace,
                                  T value,
                                  org.apache.flink.runtime.state.StateTransformationFunction<S,​T> transformation)
                           throws Exception
        Specified by:
        transform in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
        Throws:
        Exception
      • getKeys

        public java.util.stream.Stream<K> getKeys​(N namespace)
        Specified by:
        getKeys in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • sizeOfNamespace

        public int sizeOfNamespace​(Object namespace)
        Specified by:
        sizeOfNamespace in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • getStateIncrementalVisitor

        public org.apache.flink.runtime.state.internal.InternalKvState.StateIncrementalVisitor<K,​N,​S> getStateIncrementalVisitor​(int recommendedMaxNumberOfReturnedRecords)
        Specified by:
        getStateIncrementalVisitor in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>
      • releaseSnapshot

        public void releaseSnapshot​(org.apache.flink.runtime.state.heap.StateMapSnapshot<K,​N,​S,​? extends org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>> snapshotToRelease)
        Overrides:
        releaseSnapshot in class org.apache.flink.runtime.state.heap.StateMap<K,​N,​S>