private Map<Cell, Value> runReadAndExtractResults( TableReference tableRef, Function<DbReadTable, ClosableIterator<AgnosticLightResultRow>> query) { return runRead(tableRef, table -> extractResults(table, tableRef, query.apply(table))); }
private TokenBackedBasicResultsPage<RowResult<Set<Long>>, Token> getTimestampsPage( TableReference tableRef, RangeRequest range, long timestamp, long batchSize, Token token) { Stopwatch watch = Stopwatch.createStarted(); try { return runRead(tableRef, table -> getTimestampsPageInternal(table, range, timestamp, batchSize, token)); } finally { log.debug("Call to KVS.getTimestampsPage on table {} took {} ms.", tableRef, watch.elapsed(TimeUnit.MILLISECONDS)); } }
@Override public Multimap<Cell, Long> getAllTimestamps(TableReference tableRef, Set<Cell> cells, long timestamp) { return batchingQueryRunner.runTask( cells, BatchingStrategies.forIterable(), AccumulatorStrategies.forListMultimap(), cellBatch -> runRead(tableRef, table -> doGetAllTimestamps(table, cellBatch, timestamp))); }
private Map<Sha256Hash, Integer> getColumnCountsUnordered(TableReference tableRef, List<byte[]> rowList, ColumnRangeSelection columnRangeSelection, long timestamp) { return runRead(tableRef, dbReadTable -> { Map<Sha256Hash, Integer> counts = new HashMap<>(rowList.size()); try (ClosableIterator<AgnosticLightResultRow> iter = dbReadTable.getRowsColumnRangeCounts(rowList, timestamp, columnRangeSelection)) { while (iter.hasNext()) { AgnosticLightResultRow row = iter.next(); Sha256Hash rowHash = Sha256Hash.computeHash(row.getBytes(ROW)); counts.put(rowHash, row.getInteger("column_count")); } } return counts; }); }
@Override public Map<Cell, Long> getLatestTimestamps(TableReference tableRef, Map<Cell, Long> timestampByCell) { return batchingQueryRunner.runTask( timestampByCell, BatchingStrategies.forMap(), AccumulatorStrategies.forMap(), cellBatch -> runRead(tableRef, table -> doGetLatestTimestamps(table, cellBatch))); }
private Map<byte[], List<Entry<Cell, Value>>> extractRowColumnRangePage( TableReference tableRef, RowsColumnRangeBatchRequest rowsColumnRangeBatch, long ts) { return batchingQueryRunner.runTask( rowsColumnRangeBatch, RowsColumnRangeBatchRequests::partition, AccumulatorStrategies.forMap(), batch -> runRead(tableRef, table -> extractRowColumnRangePageInternal( table, tableRef, () -> table.getRowsColumnRange(batch, ts), RowsColumnRangeBatchRequests.getAllRowsInOrder(batch)))); }
private Map<byte[], List<Entry<Cell, Value>>> extractRowColumnRangePage( TableReference tableRef, Map<byte[], BatchColumnRangeSelection> columnRangeSelection, long ts) { return batchingQueryRunner.runTask( columnRangeSelection, BatchingStrategies.forMap(), AccumulatorStrategies.forMap(), batch -> runRead(tableRef, table -> extractRowColumnRangePageInternal( table, tableRef, () -> table.getRowsColumnRange(batch, ts), batch.keySet()))); }
private Map<Cell, Value> runReadAndExtractResults( TableReference tableRef, Function<DbReadTable, ClosableIterator<AgnosticLightResultRow>> query) { return runRead(tableRef, table -> extractResults(table, tableRef, query.apply(table))); }
private TokenBackedBasicResultsPage<RowResult<Set<Long>>, Token> getTimestampsPage( TableReference tableRef, RangeRequest range, long timestamp, long batchSize, Token token) { Stopwatch watch = Stopwatch.createStarted(); try { return runRead(tableRef, table -> getTimestampsPageInternal(table, range, timestamp, batchSize, token)); } finally { log.debug("Call to KVS.getTimestampsPage on table {} took {} ms.", tableRef, watch.elapsed(TimeUnit.MILLISECONDS)); } }
private Map<Sha256Hash, Integer> getColumnCountsUnordered(TableReference tableRef, List<byte[]> rowList, ColumnRangeSelection columnRangeSelection, long timestamp) { return runRead(tableRef, dbReadTable -> { Map<Sha256Hash, Integer> counts = new HashMap<>(rowList.size()); try (ClosableIterator<AgnosticLightResultRow> iter = dbReadTable.getRowsColumnRangeCounts(rowList, timestamp, columnRangeSelection)) { while (iter.hasNext()) { AgnosticLightResultRow row = iter.next(); Sha256Hash rowHash = Sha256Hash.computeHash(row.getBytes(ROW)); counts.put(rowHash, row.getInteger("column_count")); } } return counts; }); }
@Override public Map<Cell, Long> getLatestTimestamps(TableReference tableRef, Map<Cell, Long> timestampByCell) { return batchingQueryRunner.runTask( timestampByCell, BatchingStrategies.forMap(), AccumulatorStrategies.forMap(), cellBatch -> runRead(tableRef, table -> doGetLatestTimestamps(table, cellBatch))); }
@Override public Multimap<Cell, Long> getAllTimestamps(TableReference tableRef, Set<Cell> cells, long timestamp) { return batchingQueryRunner.runTask( cells, BatchingStrategies.forIterable(), AccumulatorStrategies.forListMultimap(), cellBatch -> runRead(tableRef, table -> doGetAllTimestamps(table, cellBatch, timestamp))); }
private Map<byte[], List<Entry<Cell, Value>>> extractRowColumnRangePage( TableReference tableRef, RowsColumnRangeBatchRequest rowsColumnRangeBatch, long ts) { return batchingQueryRunner.runTask( rowsColumnRangeBatch, RowsColumnRangeBatchRequests::partition, AccumulatorStrategies.forMap(), batch -> runRead(tableRef, table -> extractRowColumnRangePageInternal( table, tableRef, () -> table.getRowsColumnRange(batch, ts), RowsColumnRangeBatchRequests.getAllRowsInOrder(batch)))); }
private Map<byte[], List<Entry<Cell, Value>>> extractRowColumnRangePage( TableReference tableRef, Map<byte[], BatchColumnRangeSelection> columnRangeSelection, long ts) { return batchingQueryRunner.runTask( columnRangeSelection, BatchingStrategies.forMap(), AccumulatorStrategies.forMap(), batch -> runRead(tableRef, table -> extractRowColumnRangePageInternal( table, tableRef, () -> table.getRowsColumnRange(batch, ts), batch.keySet()))); }