use of org.tikv.kvproto.Kvrpcpb.RawScanResponse in project tispark by pingcap.
the class RegionStoreClient method rawScan.
/**
* Return a batch KvPair list containing limited key-value pairs starting from `key`, which are in
* the same region
*
* @param backOffer BackOffer
* @param key startKey
* @param keyOnly true if value of KvPair is not needed
* @return KvPair list
*/
public List<KvPair> rawScan(BackOffer backOffer, ByteString key, int limit, boolean keyOnly) {
Supplier<RawScanRequest> factory = () -> RawScanRequest.newBuilder().setContext(region.getContext()).setStartKey(key).setKeyOnly(keyOnly).setLimit(limit).build();
KVErrorHandler<RawScanResponse> handler = new KVErrorHandler<>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
RawScanResponse resp = callWithRetry(backOffer, TikvGrpc.getRawScanMethod(), factory, handler);
return rawScanHelper(resp);
}
use of org.tikv.kvproto.Kvrpcpb.RawScanResponse in project client-java by tikv.
the class RegionStoreClient method rawScan.
/**
* Return a batch KvPair list containing limited key-value pairs starting from `key`, which are in
* the same region
*
* @param backOffer BackOffer
* @param key startKey
* @param keyOnly true if value of KvPair is not needed
* @return KvPair list
*/
public List<KvPair> rawScan(BackOffer backOffer, ByteString key, int limit, boolean keyOnly) {
Long clusterId = pdClient.getClusterId();
Histogram.Timer requestTimer = GRPC_RAW_REQUEST_LATENCY.labels("client_grpc_raw_scan", clusterId.toString()).startTimer();
try {
Supplier<RawScanRequest> factory = () -> RawScanRequest.newBuilder().setContext(makeContext(storeType, backOffer.getSlowLog())).setStartKey(key).setKeyOnly(keyOnly).setLimit(limit).build();
RegionErrorHandler<RawScanResponse> handler = new RegionErrorHandler<RawScanResponse>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
RawScanResponse resp = callWithRetry(backOffer, TikvGrpc.getRawScanMethod(), factory, handler);
return rawScanHelper(resp);
} finally {
requestTimer.observeDuration();
}
}
Aggregations