use of org.tikv.kvproto.Kvrpcpb.RawBatchGetRequest in project client-java by tikv.
the class RegionStoreClient method rawBatchGet.
public List<KvPair> rawBatchGet(BackOffer backoffer, List<ByteString> keys) {
Long clusterId = pdClient.getClusterId();
Histogram.Timer requestTimer = GRPC_RAW_REQUEST_LATENCY.labels("client_grpc_raw_batch_get", clusterId.toString()).startTimer();
try {
if (keys.isEmpty()) {
return new ArrayList<>();
}
Supplier<RawBatchGetRequest> factory = () -> RawBatchGetRequest.newBuilder().setContext(makeContext(storeType, backoffer.getSlowLog())).addAllKeys(keys).build();
RegionErrorHandler<RawBatchGetResponse> handler = new RegionErrorHandler<RawBatchGetResponse>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
RawBatchGetResponse resp = callWithRetry(backoffer, TikvGrpc.getRawBatchGetMethod(), factory, handler);
return handleRawBatchGet(resp);
} finally {
requestTimer.observeDuration();
}
}
use of org.tikv.kvproto.Kvrpcpb.RawBatchGetRequest in project tispark by pingcap.
the class RegionStoreClient method rawBatchGet.
public List<KvPair> rawBatchGet(BackOffer backoffer, List<ByteString> keys) {
if (keys.isEmpty()) {
return new ArrayList<>();
}
Supplier<RawBatchGetRequest> factory = () -> RawBatchGetRequest.newBuilder().setContext(region.getContext()).addAllKeys(keys).build();
KVErrorHandler<RawBatchGetResponse> handler = new KVErrorHandler<>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
RawBatchGetResponse resp = callWithRetry(backoffer, TikvGrpc.getRawBatchGetMethod(), factory, handler);
return handleRawBatchGet(resp);
}
Aggregations