Search in sources :

Example 1 with KeyGroupPartitionedPriorityQueue

use of org.apache.flink.runtime.state.heap.KeyGroupPartitionedPriorityQueue in project flink by apache.

the class RocksDBPriorityQueueSetFactory method create.

@Nonnull
@Override
public <T extends HeapPriorityQueueElement & PriorityComparable<? super T> & Keyed<?>> KeyGroupedInternalPriorityQueue<T> create(@Nonnull String stateName, @Nonnull TypeSerializer<T> byteOrderedElementSerializer) {
    final RocksDBKeyedStateBackend.RocksDbKvStateInfo stateCFHandle = tryRegisterPriorityQueueMetaInfo(stateName, byteOrderedElementSerializer);
    final ColumnFamilyHandle columnFamilyHandle = stateCFHandle.columnFamilyHandle;
    return new KeyGroupPartitionedPriorityQueue<>(KeyExtractorFunction.forKeyedObjects(), PriorityComparator.forPriorityComparableObjects(), new KeyGroupPartitionedPriorityQueue.PartitionQueueSetFactory<T, RocksDBCachingPriorityQueueSet<T>>() {

        @Nonnull
        @Override
        public RocksDBCachingPriorityQueueSet<T> create(int keyGroupId, int numKeyGroups, @Nonnull KeyExtractorFunction<T> keyExtractor, @Nonnull PriorityComparator<T> elementPriorityComparator) {
            TreeOrderedSetCache orderedSetCache = new TreeOrderedSetCache(DEFAULT_CACHES_SIZE);
            return new RocksDBCachingPriorityQueueSet<>(keyGroupId, keyGroupPrefixBytes, db, readOptions, columnFamilyHandle, byteOrderedElementSerializer, sharedElementOutView, sharedElementInView, writeBatchWrapper, orderedSetCache);
        }
    }, keyGroupRange, numberOfKeyGroups);
}
Also used : Nonnull(javax.annotation.Nonnull) KeyGroupPartitionedPriorityQueue(org.apache.flink.runtime.state.heap.KeyGroupPartitionedPriorityQueue) ColumnFamilyHandle(org.rocksdb.ColumnFamilyHandle) Nonnull(javax.annotation.Nonnull)

Aggregations

Nonnull (javax.annotation.Nonnull)1 KeyGroupPartitionedPriorityQueue (org.apache.flink.runtime.state.heap.KeyGroupPartitionedPriorityQueue)1 ColumnFamilyHandle (org.rocksdb.ColumnFamilyHandle)1