use of org.tikv.kvproto.Kvrpcpb.RawPutRequest in project tispark by pingcap.
the class RegionStoreClient method rawPut.
public void rawPut(BackOffer backOffer, ByteString key, ByteString value, long ttl) {
Supplier<RawPutRequest> factory = () -> RawPutRequest.newBuilder().setContext(region.getContext()).setKey(key).setValue(value).setTtl(ttl).build();
KVErrorHandler<RawPutResponse> handler = new KVErrorHandler<>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
RawPutResponse resp = callWithRetry(backOffer, TikvGrpc.getRawPutMethod(), factory, handler);
rawPutHelper(resp);
}
use of org.tikv.kvproto.Kvrpcpb.RawPutRequest in project client-java by tikv.
the class RegionStoreClient method rawPut.
public void rawPut(BackOffer backOffer, ByteString key, ByteString value, long ttl, boolean atomicForCAS) {
Long clusterId = pdClient.getClusterId();
Histogram.Timer requestTimer = GRPC_RAW_REQUEST_LATENCY.labels("client_grpc_raw_put", clusterId.toString()).startTimer();
try {
Supplier<RawPutRequest> factory = () -> RawPutRequest.newBuilder().setContext(makeContext(storeType, backOffer.getSlowLog())).setKey(key).setValue(value).setTtl(ttl).setForCas(atomicForCAS).build();
RegionErrorHandler<RawPutResponse> handler = new RegionErrorHandler<RawPutResponse>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
RawPutResponse resp = callWithRetry(backOffer, TikvGrpc.getRawPutMethod(), factory, handler);
rawPutHelper(resp);
} finally {
requestTimer.observeDuration();
}
}
Aggregations