Package org.apache.flink.state.rocksdb
Interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCache
-
- All Known Implementing Classes:
TreeOrderedSetCache
- Enclosing class:
- RocksDBCachingPriorityQueueSet<E extends org.apache.flink.runtime.state.heap.HeapPriorityQueueElement>
public static interface RocksDBCachingPriorityQueueSet.OrderedByteArraySetCacheCache that is organized as an ordered set for byte-arrays. The byte-arrays are sorted in lexicographic order of their content. Caches typically have a bounded size.
-
-
Field Summary
Fields Modifier and Type Field Description static Comparator<byte[]>LEXICOGRAPHIC_BYTE_COMPARATORComparator for byte arrays.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleanadd(byte[] toAdd)Adds the given element, if it was not already contained.voidbulkLoadFromOrderedIterator(Iterator<byte[]> orderedIterator)Clears the cache and adds up tomaxSize()elements from the iterator to the cache.booleanisEmpty()Returnssize() == 0.booleanisFull()Returnssize() == maxSize().intmaxSize()Returns the maximum number of elements that can be stored in the cache.byte[]peekFirst()Returns the first element ornullif empty.byte[]peekLast()Returns the last element ornullif empty.byte[]pollFirst()Returns and removes the first element or returnsnullif empty.byte[]pollLast()Returns and removes the last element or returnsnullif empty.booleanremove(byte[] toRemove)Removes the given element, if it is contained.intsize()Returns the number of contained elements.
-
-
-
Field Detail
-
LEXICOGRAPHIC_BYTE_COMPARATOR
static final Comparator<byte[]> LEXICOGRAPHIC_BYTE_COMPARATOR
Comparator for byte arrays.
-
-
Method Detail
-
size
int size()
Returns the number of contained elements.
-
maxSize
int maxSize()
Returns the maximum number of elements that can be stored in the cache.
-
isEmpty
boolean isEmpty()
Returnssize() == 0.
-
isFull
boolean isFull()
Returnssize() == maxSize().
-
add
boolean add(@Nonnull byte[] toAdd)Adds the given element, if it was not already contained. Returnstrueiff the cache was modified.
-
remove
boolean remove(@Nonnull byte[] toRemove)Removes the given element, if it is contained. Returnstrueiff the cache was modified.
-
peekFirst
@Nullable byte[] peekFirst()
Returns the first element ornullif empty.
-
peekLast
@Nullable byte[] peekLast()
Returns the last element ornullif empty.
-
pollFirst
@Nullable byte[] pollFirst()
Returns and removes the first element or returnsnullif empty.
-
pollLast
@Nullable byte[] pollLast()
Returns and removes the last element or returnsnullif empty.
-
bulkLoadFromOrderedIterator
void bulkLoadFromOrderedIterator(@Nonnull Iterator<byte[]> orderedIterator)Clears the cache and adds up tomaxSize()elements from the iterator to the cache. Iterator must be ordered in the same order as this cache.- Parameters:
orderedIterator- iterator with elements in-order.
-
-