/** * update the contents of a set with the provided sets, ensuring that the items to remove are * really present, and that the items to add are not (unless we're also removing them) * @return a new set with the contents of the provided one modified */ static <T> Set<T> replace(Set<T> original, Set<T> remove, Iterable<T> add) { return ImmutableSet.copyOf(replace(identityMap(original), remove, add).keySet()); }
/** * update the contents of a set with the provided sets, ensuring that the items to remove are * really present, and that the items to add are not (unless we're also removing them) * @return a new set with the contents of the provided one modified */ static <T> Set<T> replace(Set<T> original, Set<T> remove, Iterable<T> add) { return ImmutableSet.copyOf(replace(identityMap(original), remove, add).keySet()); }
/** * update the contents of a set with the provided sets, ensuring that the items to remove are * really present, and that the items to add are not (unless we're also removing them) * @return a new set with the contents of the provided one modified */ static <T> Set<T> replace(Set<T> original, Set<T> remove, Iterable<T> add) { return ImmutableSet.copyOf(replace(identityMap(original), remove, add).keySet()); }
public View apply(View view) { List<Memtable> flushingMemtables = copyOf(filter(view.flushingMemtables, not(equalTo(memtable)))); assert flushingMemtables.size() == view.flushingMemtables.size() - 1; if (flushed == null || Iterables.isEmpty(flushed)) return new View(view.liveMemtables, flushingMemtables, view.sstablesMap, view.compactingMap, view.intervalTree); Map<SSTableReader, SSTableReader> sstableMap = replace(view.sstablesMap, emptySet(), flushed); return new View(view.liveMemtables, flushingMemtables, sstableMap, view.compactingMap, SSTableIntervalTree.build(sstableMap.keySet())); } };
public View apply(View view) { Map<SSTableReader, SSTableReader> sstableMap = replace(view.sstablesMap, remove, add); return new View(view.liveMemtables, view.flushingMemtables, sstableMap, view.compactingMap, SSTableIntervalTree.build(sstableMap.keySet())); } };
public View apply(View view) { List<Memtable> flushingMemtables = copyOf(filter(view.flushingMemtables, not(equalTo(memtable)))); assert flushingMemtables.size() == view.flushingMemtables.size() - 1; if (flushed == null || Iterables.isEmpty(flushed)) return new View(view.liveMemtables, flushingMemtables, view.sstablesMap, view.compactingMap, view.intervalTree); Map<SSTableReader, SSTableReader> sstableMap = replace(view.sstablesMap, emptySet(), flushed); return new View(view.liveMemtables, flushingMemtables, sstableMap, view.compactingMap, SSTableIntervalTree.build(sstableMap.keySet())); } };
public View apply(View view) { Map<SSTableReader, SSTableReader> sstableMap = replace(view.sstablesMap, remove, add); return new View(view.liveMemtables, view.flushingMemtables, sstableMap, view.compactingMap, SSTableIntervalTree.build(sstableMap.keySet())); } };
public View apply(View view) { Map<SSTableReader, SSTableReader> sstableMap = replace(view.sstablesMap, remove, add); return new View(view.liveMemtables, view.flushingMemtables, sstableMap, view.compactingMap, SSTableIntervalTree.build(sstableMap.keySet())); } };
/** * update the contents of a set with the provided sets, ensuring that the items to remove are * really present, and that the items to add are not (unless we're also removing them) * @return a new set with the contents of the provided one modified */ static <T> Set<T> replace(Set<T> original, Set<T> remove, Iterable<T> add) { return ImmutableSet.copyOf(replace(identityMap(original), remove, add).keySet()); }
public View apply(View view) { Map<SSTableReader, SSTableReader> sstableMap = replace(view.sstablesMap, remove, add); return new View(view.liveMemtables, view.flushingMemtables, sstableMap, view.compactingMap, SSTableIntervalTree.build(sstableMap.keySet())); } };
public View apply(View view) { assert all(mark, Helpers.idIn(view.sstablesMap)); return new View(view.liveMemtables, view.flushingMemtables, view.sstablesMap, replace(view.compactingMap, unmark, mark), view.intervalTree); } };
public View apply(View view) { assert all(mark, Helpers.idIn(view.sstablesMap)); return new View(view.liveMemtables, view.flushingMemtables, view.sstablesMap, replace(view.compactingMap, unmark, mark), view.intervalTree); } };
public View apply(View view) { assert all(mark, Helpers.idIn(view.sstablesMap)); return new View(view.liveMemtables, view.flushingMemtables, view.sstablesMap, replace(view.compactingMap, unmark, mark), view.intervalTree); } };
public View apply(View view) { assert all(mark, Helpers.idIn(view.sstablesMap)); return new View(view.liveMemtables, view.flushingMemtables, view.sstablesMap, replace(view.compactingMap, unmark, mark), view.intervalTree); } };
public View apply(View view) { List<Memtable> flushingMemtables = copyOf(filter(view.flushingMemtables, not(equalTo(memtable)))); assert flushingMemtables.size() == view.flushingMemtables.size() - 1; if (flushed == null || Iterables.isEmpty(flushed)) return new View(view.liveMemtables, flushingMemtables, view.sstablesMap, view.compactingMap, view.intervalTree); Map<SSTableReader, SSTableReader> sstableMap = replace(view.sstablesMap, emptySet(), flushed); return new View(view.liveMemtables, flushingMemtables, sstableMap, view.compactingMap, SSTableIntervalTree.build(sstableMap.keySet())); } };