use of org.tikv.kvproto.Kvrpcpb.RawBatchPutResponse in project tispark by pingcap.
the class RegionStoreClient method rawBatchPut.
public void rawBatchPut(BackOffer backOffer, List<KvPair> kvPairs, long ttl, boolean atomic) {
if (kvPairs.isEmpty()) {
return;
}
Supplier<RawBatchPutRequest> factory = () -> RawBatchPutRequest.newBuilder().setContext(region.getContext()).addAllPairs(kvPairs).setTtl(ttl).setForCas(atomic).build();
KVErrorHandler<RawBatchPutResponse> handler = new KVErrorHandler<>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
RawBatchPutResponse resp = callWithRetry(backOffer, TikvGrpc.getRawBatchPutMethod(), factory, handler);
handleRawBatchPut(resp);
}
use of org.tikv.kvproto.Kvrpcpb.RawBatchPutResponse in project client-java by tikv.
the class RegionStoreClient method rawBatchPut.
public void rawBatchPut(BackOffer backOffer, List<KvPair> kvPairs, long ttl, boolean atomicForCAS) {
Long clusterId = pdClient.getClusterId();
Histogram.Timer requestTimer = GRPC_RAW_REQUEST_LATENCY.labels("client_grpc_raw_batch_put", clusterId.toString()).startTimer();
try {
if (kvPairs.isEmpty()) {
return;
}
Supplier<RawBatchPutRequest> factory = () -> RawBatchPutRequest.newBuilder().setContext(makeContext(storeType, backOffer.getSlowLog())).addAllPairs(kvPairs).setTtl(ttl).addTtls(ttl).setForCas(atomicForCAS).build();
RegionErrorHandler<RawBatchPutResponse> handler = new RegionErrorHandler<RawBatchPutResponse>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
RawBatchPutResponse resp = callWithRetry(backOffer, TikvGrpc.getRawBatchPutMethod(), factory, handler);
handleRawBatchPut(resp);
} finally {
requestTimer.observeDuration();
}
}
Aggregations