@InterfaceAudience.Private public class BatchScanResultCache extends Object implements ScanResultCache
scan.getBatch() > 0 && !scan.getAllowPartialResults()
.
If user setBatch(5) and rpc returns 3+5+5+5+3 cells, we should return 5+5+5+5+1 to user. setBatch doesn't mean setAllowPartialResult(true).
Modifier and Type | Field and Description |
---|---|
private int |
batch |
private Cell |
lastCell |
private boolean |
lastResultPartial |
private int |
numberOfCompleteRows |
private int |
numCellsOfPartialResults |
private Deque<Result> |
partialResults |
EMPTY_RESULT_ARRAY
Constructor and Description |
---|
BatchScanResultCache(int batch) |
Modifier and Type | Method and Description |
---|---|
Result[] |
addAndGet(Result[] results,
boolean isHeartbeatMessage)
Add the given results to cache and get valid results back.
|
void |
clear()
Clear the cached result if any.
|
private Result |
createCompletedResult() |
int |
numberOfCompleteRows()
Return the number of complete rows.
|
private void |
recordLastResult(Result result) |
private Result |
regroupResults(Result result) |
private final int batch
private boolean lastResultPartial
private final Deque<Result> partialResults
private int numCellsOfPartialResults
private int numberOfCompleteRows
public BatchScanResultCache(int batch)
private void recordLastResult(Result result)
private Result createCompletedResult() throws IOException
IOException
private Result regroupResults(Result result)
public Result[] addAndGet(Result[] results, boolean isHeartbeatMessage) throws IOException
ScanResultCache
addAndGet
in interface ScanResultCache
results
- the results of a scan next. Must not be null.isHeartbeatMessage
- indicate whether the results is gotten from a heartbeat response.IOException
public void clear()
ScanResultCache
clear
in interface ScanResultCache
public int numberOfCompleteRows()
ScanResultCache
numberOfCompleteRows
in interface ScanResultCache
Copyright © 2007–2020 The Apache Software Foundation. All rights reserved.