Package org.apache.flink.state.rocksdb
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 ClassesModifier and TypeClassDescriptionstatic interfaceCache 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
Methods inherited from class org.apache.flink.runtime.state.heap.AbstractHeapPriorityQueueElement
getInternalIndex, setInternalIndex
-
Method Details
-
peek
- Specified by:
peekin interfaceorg.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
-
poll
- Specified by:
pollin interfaceorg.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
-
add
- Specified by:
addin interfaceorg.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
-
remove
- Specified by:
removein interfaceorg.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
-
addAll
- Specified by:
addAllin interfaceorg.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
-
isEmpty
public boolean isEmpty()- Specified by:
isEmptyin interfaceorg.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
-
iterator
- Specified by:
iteratorin interfaceorg.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:
sizein interfaceorg.apache.flink.runtime.state.InternalPriorityQueue<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
-