IDiskAtomFilter filter = ThriftValidation.asIFilter(predicate, cfm, null); RangeSliceCommand cmd = new RangeSliceCommand(keyspace, columnFamily, nowMillis, filter, new Bounds<RowPosition>(startPosition, endPosition), pageSize);
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position); // Check if the split would have no effect on the range if (position.equals(right)) return null; AbstractBounds<T> lb = new Bounds<T>(left, position); AbstractBounds<T> rb = new Range<T>(position, right); return Pair.create(lb, rb); }
private static Set<SSTableReader> overlappingWithBounds(Token start, Token end, Map<SSTableReader, Bounds<Token>> sstables) { assert start.compareTo(end) <= 0; Set<SSTableReader> overlapped = new HashSet<>(); Bounds<Token> promotedBounds = new Bounds<Token>(start, end); for (Map.Entry<SSTableReader, Bounds<Token>> pair : sstables.entrySet()) { if (pair.getValue().intersects(promotedBounds)) overlapped.add(pair.getKey()); } return overlapped; }
boundsToInvalidate.add(new Bounds<Token>(sstable.first.getToken(), sstable.last.getToken())); Set<Bounds<Token>> nonOverlappingBounds = Bounds.getNonOverlappingBounds(boundsToInvalidate);
public static <T extends RingPosition<T>> boolean isInBounds(T token, Iterable<Bounds<T>> bounds) { assert bounds != null; for (Bounds<T> bound : bounds) { if (bound.contains(token)) { return true; } } return false; }
public int invalidateRowCache(Collection<Bounds<Token>> boundsToInvalidate) { int invalidatedKeys = 0; for (Iterator<RowCacheKey> keyIter = CacheService.instance.rowCache.keyIterator(); keyIter.hasNext(); ) { RowCacheKey key = keyIter.next(); DecoratedKey dk = decorateKey(ByteBuffer.wrap(key.key)); if (key.ksAndCFName.equals(metadata.ksAndCFName) && Bounds.isInBounds(dk.getToken(), boundsToInvalidate)) { invalidateCachedPartition(dk); invalidatedKeys++; } } return invalidatedKeys; }
public Bounds(T left, T right) { super(left, right); // unlike a Range, a Bounds may not wrap assert !strictlyWrapsAround(left, right) : "[" + left + "," + right + "]"; }
readers.forEach(sstable -> boundsToInvalidate.add(new Bounds<Token>(sstable.first.getToken(), sstable.last.getToken()))); Set<Bounds<Token>> nonOverlappingBounds = Bounds.getNonOverlappingBounds(boundsToInvalidate);
public static <T extends RingPosition<T>> boolean isInBounds(T token, Iterable<Bounds<T>> bounds) { assert bounds != null; for (Bounds<T> bound : bounds) { if (bound.contains(token)) { return true; } } return false; }
public int invalidateCounterCache(Collection<Bounds<Token>> boundsToInvalidate) { int invalidatedKeys = 0; for (Iterator<CounterCacheKey> keyIter = CacheService.instance.counterCache.keyIterator(); keyIter.hasNext(); ) { CounterCacheKey key = keyIter.next(); DecoratedKey dk = decorateKey(ByteBuffer.wrap(key.partitionKey)); if (key.ksAndCFName.equals(metadata.ksAndCFName) && Bounds.isInBounds(dk.getToken(), boundsToInvalidate)) { CacheService.instance.counterCache.remove(key); invalidatedKeys++; } } return invalidatedKeys; }
public Bounds(T left, T right) { super(left, right); // unlike a Range, a Bounds may not wrap assert !strictlyWrapsAround(left, right) : "[" + left + "," + right + "]"; }
public AbstractBounds<T> withNewRight(T newRight) { return new Bounds<T>(left, newRight); }
private static Set<SSTableReader> overlappingWithBounds(Token start, Token end, Map<SSTableReader, Bounds<Token>> sstables) { assert start.compareTo(end) <= 0; Set<SSTableReader> overlapped = new HashSet<>(); Bounds<Token> promotedBounds = new Bounds<Token>(start, end); for (Map.Entry<SSTableReader, Bounds<Token>> pair : sstables.entrySet()) { if (pair.getValue().intersects(promotedBounds)) overlapped.add(pair.getKey()); } return overlapped; }
public Pair<AbstractBounds<T>, AbstractBounds<T>> split(T position) { assert contains(position); // Check if the split would have no effect on the range if (position.equals(right)) return null; AbstractBounds<T> lb = new Bounds<T>(left, position); AbstractBounds<T> rb = new Range<T>(position, right); return Pair.create(lb, rb); }
readers.forEach(sstable -> boundsToInvalidate.add(new Bounds<Token>(sstable.first.getToken(), sstable.last.getToken()))); Set<Bounds<Token>> nonOverlappingBounds = Bounds.getNonOverlappingBounds(boundsToInvalidate);
public int invalidateCounterCache(Collection<Bounds<Token>> boundsToInvalidate) { int invalidatedKeys = 0; for (Iterator<CounterCacheKey> keyIter = CacheService.instance.counterCache.keyIterator(); keyIter.hasNext(); ) { CounterCacheKey key = keyIter.next(); DecoratedKey dk = decorateKey(ByteBuffer.wrap(key.partitionKey)); if (key.ksAndCFName.equals(metadata.ksAndCFName) && Bounds.isInBounds(dk.getToken(), boundsToInvalidate)) { CacheService.instance.counterCache.remove(key); invalidatedKeys++; } } return invalidatedKeys; }
public Bounds(T left, T right) { super(left, right); // unlike a Range, a Bounds may not wrap assert !strictlyWrapsAround(left, right) : "[" + left + "," + right + "]"; }
private static AbstractBounds<PartitionPosition> fullRange(SSTableReader sstable) { return new Bounds<PartitionPosition>(sstable.first, sstable.last); }
private static Set<SSTableReader> overlappingWithBounds(Token start, Token end, Map<SSTableReader, Bounds<Token>> sstables) { assert start.compareTo(end) <= 0; Set<SSTableReader> overlapped = new HashSet<>(); Bounds<Token> promotedBounds = new Bounds<Token>(start, end); for (Map.Entry<SSTableReader, Bounds<Token>> pair : sstables.entrySet()) { if (pair.getValue().intersects(promotedBounds)) overlapped.add(pair.getKey()); } return overlapped; }