use of org.apache.hadoop.hbase.CellScannable in project hbase by apache.
the class MockRegionServer method scan.
@Override
public ScanResponse scan(RpcController controller, ScanRequest request) throws ServiceException {
ScanResponse.Builder builder = ScanResponse.newBuilder();
try {
if (request.hasScan()) {
byte[] regionName = request.getRegion().getValue().toByteArray();
builder.setScannerId(openScanner(regionName, null));
builder.setMoreResults(true);
} else {
long scannerId = request.getScannerId();
Result result = next(scannerId);
if (result != null) {
builder.addCellsPerResult(result.size());
List<CellScannable> results = new ArrayList<>(1);
results.add(result);
((HBaseRpcController) controller).setCellScanner(CellUtil.createCellScanner(results));
builder.setMoreResults(true);
} else {
builder.setMoreResults(false);
close(scannerId);
}
}
} catch (IOException ie) {
throw new ServiceException(ie);
}
return builder.build();
}
Aggregations