Search in sources :

Example 1 with RawDeleteRequest

use of org.tikv.kvproto.Kvrpcpb.RawDeleteRequest in project tispark by pingcap.

the class RegionStoreClient method rawDelete.

public void rawDelete(BackOffer backOffer, ByteString key) {
    Supplier<RawDeleteRequest> factory = () -> RawDeleteRequest.newBuilder().setContext(region.getContext()).setKey(key).build();
    KVErrorHandler<RawDeleteResponse> handler = new KVErrorHandler<>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
    RawDeleteResponse resp = callWithRetry(backOffer, TikvGrpc.getRawDeleteMethod(), factory, handler);
    rawDeleteHelper(resp, region);
}
Also used : RawDeleteRequest(org.tikv.kvproto.Kvrpcpb.RawDeleteRequest) RawDeleteResponse(org.tikv.kvproto.Kvrpcpb.RawDeleteResponse) KVErrorHandler(com.pingcap.tikv.operation.KVErrorHandler)

Example 2 with RawDeleteRequest

use of org.tikv.kvproto.Kvrpcpb.RawDeleteRequest in project client-java by tikv.

the class RegionStoreClient method rawDelete.

public void rawDelete(BackOffer backOffer, ByteString key, boolean atomicForCAS) {
    Long clusterId = pdClient.getClusterId();
    Histogram.Timer requestTimer = GRPC_RAW_REQUEST_LATENCY.labels("client_grpc_raw_delete", clusterId.toString()).startTimer();
    try {
        Supplier<RawDeleteRequest> factory = () -> RawDeleteRequest.newBuilder().setContext(makeContext(storeType, backOffer.getSlowLog())).setKey(key).setForCas(atomicForCAS).build();
        RegionErrorHandler<RawDeleteResponse> handler = new RegionErrorHandler<RawDeleteResponse>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
        RawDeleteResponse resp = callWithRetry(backOffer, TikvGrpc.getRawDeleteMethod(), factory, handler);
        rawDeleteHelper(resp, region);
    } finally {
        requestTimer.observeDuration();
    }
}
Also used : Histogram(io.prometheus.client.Histogram) RawDeleteRequest(org.tikv.kvproto.Kvrpcpb.RawDeleteRequest) RawDeleteResponse(org.tikv.kvproto.Kvrpcpb.RawDeleteResponse) RegionErrorHandler(org.tikv.common.operation.RegionErrorHandler)

Aggregations

RawDeleteRequest (org.tikv.kvproto.Kvrpcpb.RawDeleteRequest)2 RawDeleteResponse (org.tikv.kvproto.Kvrpcpb.RawDeleteResponse)2 KVErrorHandler (com.pingcap.tikv.operation.KVErrorHandler)1 Histogram (io.prometheus.client.Histogram)1 RegionErrorHandler (org.tikv.common.operation.RegionErrorHandler)1