private Optional<Long> getCandidatesInCoarsePartition(ShardAndStrategy shardStrategy, long partitionCoarse, ColumnRangeSelection colRange) { byte[] rowBytes = computeRowBytes(shardStrategy, partitionCoarse); RowColumnRangeIterator colIterator = getRowsColumnRange(ImmutableList.of(rowBytes), colRange, 1); if (!colIterator.hasNext()) { return Optional.empty(); } Map.Entry<Cell, Value> firstColumnEntry = colIterator.next(); return Optional.of(getFinePartitionFromEntry(firstColumnEntry)); }
/** * Deletes the entire row of the Sweepable Timestamps table. * @param shardStrategy desired shard and strategy * @param partitionCoarse coarse partition for which the row should be deleted */ void deleteRow(ShardAndStrategy shardStrategy, long partitionCoarse) { byte[] rowBytes = computeRowBytes(shardStrategy, partitionCoarse); RangeRequest request = RangeRequest.builder() .startRowInclusive(rowBytes) .endRowExclusive(RangeRequests.nextLexicographicName(rowBytes)) .retainColumns(ColumnSelection.all()) .build(); deleteRange(request); } }
private Optional<Long> getCandidatesInCoarsePartition(ShardAndStrategy shardStrategy, long partitionCoarse, ColumnRangeSelection colRange) { byte[] rowBytes = computeRowBytes(shardStrategy, partitionCoarse); RowColumnRangeIterator colIterator = getRowsColumnRange(ImmutableList.of(rowBytes), colRange, 1); if (!colIterator.hasNext()) { return Optional.empty(); } Map.Entry<Cell, Value> firstColumnEntry = colIterator.next(); return Optional.of(getFinePartitionFromEntry(firstColumnEntry)); }
/** * Deletes the entire row of the Sweepable Timestamps table. * @param shardStrategy desired shard and strategy * @param partitionCoarse coarse partition for which the row should be deleted */ void deleteRow(ShardAndStrategy shardStrategy, long partitionCoarse) { byte[] rowBytes = computeRowBytes(shardStrategy, partitionCoarse); RangeRequest request = RangeRequest.builder() .startRowInclusive(rowBytes) .endRowExclusive(RangeRequests.nextLexicographicName(rowBytes)) .retainColumns(ColumnSelection.all()) .build(); deleteRange(request); } }