/** * Prefetch all combining value state for {@code address} across all merging windows in {@code * context}. */ public static <K, StateT extends GroupingState<?, ?>, W extends BoundedWindow> void prefetchCombiningValues(MergingStateAccessor<K, W> context, StateTag<StateT> address) { for (StateT state : context.accessInEachMergingWindow(address).values()) { prefetchRead(state); } }
/** * Prefetch all bag state in {@code address} across all windows under merge in {@code context}, * except for the bag state in the final state address window which we can blindly append to. */ public static <K, T, W extends BoundedWindow> void prefetchBags( MergingStateAccessor<K, W> context, StateTag<BagState<T>> address) { Map<W, BagState<T>> map = context.accessInEachMergingWindow(address); if (map.isEmpty()) { // Nothing to prefetch. return; } BagState<T> result = context.access(address); // Prefetch everything except what's already in result. for (BagState<T> source : map.values()) { if (!source.equals(result)) { prefetchRead(source); } } }
for (BagState<T> source : sources) { if (!source.equals(result)) { prefetchRead(source); futures.add(source);
for (SetState<T> source : sources) { if (!source.equals(result)) { prefetchRead(source); futures.add(source);