public BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(getAllValidTimestamps(candidates)); ImmutableBatchOfCellsToSweep.Builder builder = ImmutableBatchOfCellsToSweep.builder(); long numCellTsPairsExamined = 0; for (CandidateCellForSweeping candidate : candidates) { getCellToSweep(candidate, startToCommitTs).ifPresent(builder::addCells); numCellTsPairsExamined += candidate.sortedTimestamps().size(); } return builder .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(candidates.get(candidates.size() - 1).cell()) .build(); }
.cells(batch) .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(lastCellExamined) .build();
private static BatchOfCellsToSweep batchWithThreeTssPerCell(int firstCell, int numCells, int numCellsExaminedInBatch) { List<CellToSweep> cells = Lists.newArrayList(); for (int i = 0; i < numCells; ++i) { cells.add(cellWithThreeTimestamps(firstCell + i, 0)); } return ImmutableBatchOfCellsToSweep.builder() .cells(cells) .numCellTsPairsExamined(numCellsExaminedInBatch) .lastCellExamined(cell(firstCell + numCells, 0)) .build(); }
.cells(batch) .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(lastCellExamined) .build();
public BatchOfCellsToSweep getCellsToSweep(List<CandidateCellForSweeping> candidates) { Map<Long, Long> startToCommitTs = commitTsCache.loadBatch(getAllValidTimestamps(candidates)); ImmutableBatchOfCellsToSweep.Builder builder = ImmutableBatchOfCellsToSweep.builder(); long numCellTsPairsExamined = 0; for (CandidateCellForSweeping candidate : candidates) { getCellToSweep(candidate, startToCommitTs).ifPresent(builder::addCells); numCellTsPairsExamined += candidate.sortedTimestamps().size(); } return builder .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(candidates.get(candidates.size() - 1).cell()) .build(); }
private static BatchOfCellsToSweep batch(List<CellToSweep> cells, int numCellTsPairsExamined, Cell lastExamined) { return ImmutableBatchOfCellsToSweep.builder() .cells(cells) .numCellTsPairsExamined(numCellTsPairsExamined) .lastCellExamined(lastExamined) .build(); }