@Override protected Set<Long> processCell(Pair<Cell, Long> cellAndInitialTs) { Cell cell = cellAndInitialTs.lhSide; Set<Long> ret = Sets.newHashSet(); if (cellAndInitialTs.rhSide < maxTimestamp) { ret.add(cellAndInitialTs.rhSide); } for (it.next(); it.isValid(); it.next()) { Pair<Cell, Long> cellAndTs = RocksDbKeyValueServices.parseCellAndTs(it.key()); if (!cellAndTs.lhSide.equals(cell)) { break; } if (cellAndTs.rhSide < maxTimestamp) { ret.add(cellAndTs.rhSide); } } return ret.isEmpty() ? null : ret; } }
@Override protected Set<Value> processCell(Pair<Cell, Long> cellAndInitialTs) { Cell cell = cellAndInitialTs.lhSide; Set<Value> ret = Sets.newHashSet(); if (cellAndInitialTs.rhSide < maxTimestamp) { ret.add(Value.create(it.value(), cellAndInitialTs.rhSide)); } for (it.next(); it.isValid(); it.next()) { Pair<Cell, Long> cellAndTs = RocksDbKeyValueServices.parseCellAndTs(it.key()); if (!cellAndTs.lhSide.equals(cell)) { break; } if (cellAndTs.rhSide < maxTimestamp) { ret.add(Value.create(it.value(), cellAndTs.rhSide)); } } return ret.isEmpty() ? null : ret; } }
static Long getTimestamp(RocksIterator iter, Cell cell, long timestamp) { iter.seek(getKey(cell, timestamp - 1)); if (iter.isValid()) { Pair<Cell, Long> cellAndTs = parseCellAndTs(iter.key()); if (cellAndTs.lhSide.equals(cell)) { return cellAndTs.rhSide; } } return null; }
static void getTimestamps(RocksIterator iter, Cell cell, long timestamp, @Output Multimap<Cell, Long> results) { iter.seek(getKey(cell, timestamp - 1)); for (; iter.isValid(); iter.next()) { Pair<Cell, Long> cellAndTs = parseCellAndTs(iter.key()); if (!cell.equals(cellAndTs.lhSide)) { return; } results.put(cellAndTs.lhSide, cellAndTs.rhSide); } }
static Value getCell(RocksIterator iter, Cell cell, long timestamp) { iter.seek(getKey(cell, timestamp - 1)); if (iter.isValid()) { Pair<Cell, Long> cellAndTs = parseCellAndTs(iter.key()); if (cellAndTs.lhSide.equals(cell)) { return Value.create(iter.value(), cellAndTs.rhSide); } } return null; }
@Override protected Value processCell(Pair<Cell, Long> cellAndInitialTs) { Cell cell = cellAndInitialTs.lhSide; Value ret = null; if (cellAndInitialTs.rhSide < maxTimestamp) { ret = Value.create(it.value(), cellAndInitialTs.rhSide); } for (it.next(); it.isValid(); it.next()) { Pair<Cell, Long> cellAndTs = RocksDbKeyValueServices.parseCellAndTs(it.key()); if (!cellAndTs.lhSide.equals(cell)) { break; } if (ret == null && cellAndTs.rhSide < maxTimestamp) { ret = Value.create(it.value(), cellAndTs.rhSide); } } return ret; } }