elementWriterFunction, stateSnapshotTransformer) : new StateTableKeyGroupPartitioner<>( snapshotData, numberOfEntriesInSnapshotData, numberOfKeyGroups, elementWriterFunction); partitionedStateTableSnapshot = stateTableKeyGroupPartitioner.partitionByKeyGroup();
elementWriterFunction, stateSnapshotTransformer) : new StateTableKeyGroupPartitioner<>( snapshotData, numberOfEntriesInSnapshotData, numberOfKeyGroups, elementWriterFunction); partitionedStateTableSnapshot = stateTableKeyGroupPartitioner.partitionByKeyGroup();
/** Tries to append next entry to {@code partitioningSource} array snapshot and returns next index.*/ int tryAddToSource(int currentIndex, CopyOnWriteStateTable.StateTableEntry<K, N, S> entry) { final int keyGroup = KeyGroupRangeAssignment.assignToKeyGroup(entry.key, totalKeyGroups); reportKeyGroupOfElementAtIndex(currentIndex, keyGroup); partitioningSource[currentIndex] = entry; return currentIndex + 1; } }
@Override int tryAddToSource(int currentIndex, CopyOnWriteStateTable.StateTableEntry<K, N, S> entry) { CopyOnWriteStateTable.StateTableEntry<K, N, S> filteredEntry = filterEntry(entry); if (filteredEntry != null) { return super.tryAddToSource(currentIndex, filteredEntry); } return currentIndex; }
@Override protected void reportAllElementKeyGroups() { // In this step we i) 'flatten' the linked list of entries to a second array and ii) report key-groups. int flattenIndex = 0; for (CopyOnWriteStateTable.StateTableEntry<K, N, S> entry : partitioningDestination) { while (null != entry) { flattenIndex = tryAddToSource(flattenIndex, entry); entry = entry.next; } } }
@Override protected void reportAllElementKeyGroups() { // In this step we i) 'flatten' the linked list of entries to a second array and ii) report key-groups. int flattenIndex = 0; for (CopyOnWriteStateTable.StateTableEntry<K, N, S> entry : partitioningDestination) { while (null != entry) { flattenIndex = tryAddToSource(flattenIndex, entry); entry = entry.next; } } }
@Override int tryAddToSource(int currentIndex, CopyOnWriteStateTable.StateTableEntry<K, N, S> entry) { CopyOnWriteStateTable.StateTableEntry<K, N, S> filteredEntry = filterEntry(entry); if (filteredEntry != null) { return super.tryAddToSource(currentIndex, filteredEntry); } return currentIndex; }
/** Tries to append next entry to {@code partitioningSource} array snapshot and returns next index.*/ int tryAddToSource(int currentIndex, CopyOnWriteStateTable.StateTableEntry<K, N, S> entry) { final int keyGroup = KeyGroupRangeAssignment.assignToKeyGroup(entry.key, totalKeyGroups); reportKeyGroupOfElementAtIndex(currentIndex, keyGroup); partitioningSource[currentIndex] = entry; return currentIndex + 1; } }