RowColumnRangeIterator getRowsColumnRange(Iterable<byte[]> rows, ColumnRangeSelection columnRange, int batchSize) { return new LocalRowColumnRangeIterator(Streams.stream(rows) .flatMap(row -> getBatchForRow(row, columnRange, batchSize)) .flatMap(Streams::stream) .iterator()); }
public void enqueue(List<WriteInfo> allWrites) { Map<Cell, byte[]> referencesToDedicatedCells = new HashMap<>(); Map<Cell, byte[]> cellsToWrite = new HashMap<>(); Map<PartitionInfo, List<WriteInfo>> partitionedWrites = partitioner.filterAndPartition(allWrites); partitionedWrites.forEach((partitionInfo, writes) -> { referencesToDedicatedCells.putAll(populateReferences(partitionInfo, writes)); cellsToWrite.putAll(populateCells(partitionInfo, writes)); }); partitionedWrites.keySet().stream() .map(PartitionInfo::timestamp) .mapToLong(x -> x) .max() .ifPresent(timestamp -> { write(referencesToDedicatedCells, timestamp); write(cellsToWrite, timestamp); updateWriteMetrics(partitionedWrites); }); }
List<WriteInfo> writeToCellsInFixedShard(SweepQueueTable writer, long ts, int number, TableReference tableRef) { List<WriteInfo> result = new ArrayList<>(); for (long i = 0; i < number; i++) { Cell cell = getCellWithFixedHash(i); result.add(WriteInfo.write(tableRef, cell, ts)); } putTimestampIntoTransactionTable(ts, ts); writer.enqueue(result); return result; }
private int write(SweepQueueTable writer, long ts, Cell cell, boolean isTombstone, TableReference tableRef) { WriteInfo write = WriteInfo.of(WriteReference.of(tableRef, cell, isTombstone), ts); writer.enqueue(ImmutableList.of(write)); return write.toShard(numShards); }
public void enqueue(List<WriteInfo> allWrites) { Map<Cell, byte[]> referencesToDedicatedCells = new HashMap<>(); Map<Cell, byte[]> cellsToWrite = new HashMap<>(); Map<PartitionInfo, List<WriteInfo>> partitionedWrites = partitioner.filterAndPartition(allWrites); partitionedWrites.forEach((partitionInfo, writes) -> { referencesToDedicatedCells.putAll(populateReferences(partitionInfo, writes)); cellsToWrite.putAll(populateCells(partitionInfo, writes)); }); partitionedWrites.keySet().stream() .map(PartitionInfo::timestamp) .mapToLong(x -> x) .max() .ifPresent(timestamp -> { write(referencesToDedicatedCells, timestamp); write(cellsToWrite, timestamp); updateWriteMetrics(partitionedWrites); }); }
RowColumnRangeIterator getRowsColumnRange(Iterable<byte[]> rows, ColumnRangeSelection columnRange, int batchSize) { return new LocalRowColumnRangeIterator(Streams.stream(rows) .flatMap(row -> getBatchForRow(row, columnRange, batchSize)) .flatMap(Streams::stream) .iterator()); }