Class RocksDBCachingPriorityQueueSet<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>

java.lang.Object
org.apache.flink.runtime.state.heap.AbstractHeapPriorityQueueElement
org.apache.flink.state.rocksdb.RocksDBCachingPriorityQueueSet<E>
Type Parameters:
E - the type of the contained elements in the queue.
All Implemented Interfaces:
org.apache.flink.runtime.state.heap.HeapPriorityQueueElement, org.apache.flink.runtime.state.InternalPriorityQueue<E>

public class RocksDBCachingPriorityQueueSet<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement> extends org.apache.flink.runtime.state.heap.AbstractHeapPriorityQueueElement implements org.apache.flink.runtime.state.InternalPriorityQueue<E>
A priority queue with set semantics, implemented on top of RocksDB. This uses a TreeSet to cache the bytes of up to the first n elements from RocksDB in memory to reduce interaction with RocksDB, in particular seek operations. Cache uses a simple write-through policy.
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static interface 
    Cache that is organized as an ordered set for byte-arrays.
  • Field Summary

    Fields inherited from interface org.apache.flink.runtime.state.heap.HeapPriorityQueueElement

    NOT_CONTAINED
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    add(E toAdd)
     
    void
    addAll(Collection<? extends E> toAdd)
     
    boolean
     
    org.apache.flink.util.CloseableIterator<E>
     
     
     
    boolean
    remove(E toRemove)
     
    int
    This implementation comes at a relatively high cost per invocation.

    Methods inherited from class org.apache.flink.runtime.state.heap.AbstractHeapPriorityQueueElement

    getInternalIndex, setInternalIndex

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Method Details

    • peek

      @Nullable public E peek()
      Specified by:
      peek in interface org.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
    • poll

      @Nullable public E poll()
      Specified by:
      poll in interface org.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
    • add

      public boolean add(@Nonnull E toAdd)
      Specified by:
      add in interface org.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
    • remove

      public boolean remove(@Nonnull E toRemove)
      Specified by:
      remove in interface org.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
    • addAll

      public void addAll(@Nullable Collection<? extends E> toAdd)
      Specified by:
      addAll in interface org.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface org.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
    • iterator

      @Nonnull public org.apache.flink.util.CloseableIterator<E> iterator()
      Specified by:
      iterator in interface org.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
    • size

      public int size()
      This implementation comes at a relatively high cost per invocation. It should not be called repeatedly when it is clear that the value did not change. Currently this is only truly used to realize certain higher-level tests.
      Specified by:
      size in interface org.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>