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);
}
Aggregations