@Nonnull @Override public StateSnapshotKeyGroupReader keyGroupReader(int readVersionHint) { final TypeSerializer<T> elementSerializer = metaInfo.getElementSerializer(); return KeyGroupPartitioner.createKeyGroupPartitionReader( elementSerializer::deserialize, //we know that this does not deliver nulls, because we never write nulls (element, keyGroupId) -> priorityQueue.add(element)); }
@Nonnull @Override public StateSnapshotKeyGroupReader keyGroupReader(int readVersionHint) { final TypeSerializer<T> elementSerializer = metaInfo.getElementSerializer(); return KeyGroupPartitioner.createKeyGroupPartitionReader( elementSerializer::deserialize, //we know that this does not deliver nulls, because we never write nulls (element, keyGroupId) -> priorityQueue.add(element)); }
@SuppressWarnings("unchecked") @Nonnull @Override public StateKeyGroupWriter getKeyGroupWriter() { if (stateKeyGroupWriter == null) { T[] partitioningOutput = (T[]) Array.newInstance( heapArrayCopy.getClass().getComponentType(), heapArrayCopy.length); final TypeSerializer<T> elementSerializer = metaInfo.getElementSerializer(); KeyGroupPartitioner<T> keyGroupPartitioner = new KeyGroupPartitioner<>( heapArrayCopy, heapArrayCopy.length, partitioningOutput, keyGroupRange, totalKeyGroups, keyExtractor, elementSerializer::serialize); stateKeyGroupWriter = keyGroupPartitioner.partitionByKeyGroup(); } return stateKeyGroupWriter; }
@SuppressWarnings("unchecked") @Nonnull @Override public StateKeyGroupWriter getKeyGroupWriter() { if (stateKeyGroupWriter == null) { T[] partitioningOutput = (T[]) Array.newInstance( heapArrayCopy.getClass().getComponentType(), heapArrayCopy.length); final TypeSerializer<T> elementSerializer = metaInfo.getElementSerializer(); KeyGroupPartitioner<T> keyGroupPartitioner = new KeyGroupPartitioner<>( heapArrayCopy, heapArrayCopy.length, partitioningOutput, keyGroupRange, totalKeyGroups, keyExtractor, elementSerializer::serialize); stateKeyGroupWriter = keyGroupPartitioner.partitionByKeyGroup(); } return stateKeyGroupWriter; }
public RegisteredPriorityQueueStateBackendMetaInfo deepCopy() { return new RegisteredPriorityQueueStateBackendMetaInfo<>(name, getElementSerializer().duplicate()); } }
public RegisteredPriorityQueueStateBackendMetaInfo deepCopy() { return new RegisteredPriorityQueueStateBackendMetaInfo<>(name, getElementSerializer().duplicate()); } }
@Nonnull private <T extends HeapPriorityQueueElement & PriorityComparable & Keyed> KeyGroupedInternalPriorityQueue<T> createInternal( RegisteredPriorityQueueStateBackendMetaInfo<T> metaInfo) { final String stateName = metaInfo.getName(); final HeapPriorityQueueSet<T> priorityQueue = priorityQueueSetFactory.create( stateName, metaInfo.getElementSerializer()); HeapPriorityQueueSnapshotRestoreWrapper<T> wrapper = new HeapPriorityQueueSnapshotRestoreWrapper<>( priorityQueue, metaInfo, KeyExtractorFunction.forKeyedObjects(), keyGroupRange, numberOfKeyGroups); registeredPQStates.put(stateName, wrapper); return priorityQueue; }
@Nonnull private <T extends HeapPriorityQueueElement & PriorityComparable & Keyed> KeyGroupedInternalPriorityQueue<T> createInternal( RegisteredPriorityQueueStateBackendMetaInfo<T> metaInfo) { final String stateName = metaInfo.getName(); final HeapPriorityQueueSet<T> priorityQueue = priorityQueueSetFactory.create( stateName, metaInfo.getElementSerializer()); HeapPriorityQueueSnapshotRestoreWrapper<T> wrapper = new HeapPriorityQueueSnapshotRestoreWrapper<>( priorityQueue, metaInfo, KeyExtractorFunction.forKeyedObjects(), keyGroupRange, numberOfKeyGroups); registeredPQStates.put(stateName, wrapper); return priorityQueue; }
private StateMetaInfoSnapshot computeSnapshot() { TypeSerializer<T> elementSerializer = getElementSerializer(); Map<String, TypeSerializer<?>> serializerMap = Collections.singletonMap( StateMetaInfoSnapshot.CommonSerializerKeys.VALUE_SERIALIZER.toString(), elementSerializer.duplicate()); Map<String, TypeSerializerSnapshot<?>> serializerSnapshotMap = Collections.singletonMap( StateMetaInfoSnapshot.CommonSerializerKeys.VALUE_SERIALIZER.toString(), elementSerializer.snapshotConfiguration()); return new StateMetaInfoSnapshot( name, StateMetaInfoSnapshot.BackendStateType.PRIORITY_QUEUE, Collections.emptyMap(), serializerSnapshotMap, serializerMap); }
private StateMetaInfoSnapshot computeSnapshot() { TypeSerializer<T> elementSerializer = getElementSerializer(); Map<String, TypeSerializer<?>> serializerMap = Collections.singletonMap( StateMetaInfoSnapshot.CommonSerializerKeys.VALUE_SERIALIZER.toString(), elementSerializer.duplicate()); Map<String, TypeSerializerSnapshot<?>> serializerSnapshotMap = Collections.singletonMap( StateMetaInfoSnapshot.CommonSerializerKeys.VALUE_SERIALIZER.toString(), elementSerializer.snapshotConfiguration()); return new StateMetaInfoSnapshot( name, StateMetaInfoSnapshot.BackendStateType.PRIORITY_QUEUE, Collections.emptyMap(), serializerSnapshotMap, serializerMap); }