Search in sources :

Example 1 with RawGetKeyTTLRequest

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

the class RegionStoreClient method rawGetKeyTTL.

public Optional<Long> rawGetKeyTTL(BackOffer backOffer, ByteString key) {
    Long clusterId = pdClient.getClusterId();
    Histogram.Timer requestTimer = GRPC_RAW_REQUEST_LATENCY.labels("client_grpc_raw_get_key_ttl", clusterId.toString()).startTimer();
    try {
        Supplier<RawGetKeyTTLRequest> factory = () -> RawGetKeyTTLRequest.newBuilder().setContext(makeContext(storeType, backOffer.getSlowLog())).setKey(key).build();
        RegionErrorHandler<RawGetKeyTTLResponse> handler = new RegionErrorHandler<RawGetKeyTTLResponse>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
        RawGetKeyTTLResponse resp = callWithRetry(backOffer, TikvGrpc.getRawGetKeyTTLMethod(), factory, handler);
        return rawGetKeyTTLHelper(resp);
    } finally {
        requestTimer.observeDuration();
    }
}
Also used : RawGetKeyTTLRequest(org.tikv.kvproto.Kvrpcpb.RawGetKeyTTLRequest) Histogram(io.prometheus.client.Histogram) RawGetKeyTTLResponse(org.tikv.kvproto.Kvrpcpb.RawGetKeyTTLResponse) RegionErrorHandler(org.tikv.common.operation.RegionErrorHandler)

Example 2 with RawGetKeyTTLRequest

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

the class RegionStoreClient method rawGetKeyTTL.

public Long rawGetKeyTTL(BackOffer backOffer, ByteString key) {
    Supplier<RawGetKeyTTLRequest> factory = () -> RawGetKeyTTLRequest.newBuilder().setContext(region.getContext()).setKey(key).build();
    KVErrorHandler<RawGetKeyTTLResponse> handler = new KVErrorHandler<>(regionManager, this, resp -> resp.hasRegionError() ? resp.getRegionError() : null);
    RawGetKeyTTLResponse resp = callWithRetry(backOffer, TikvGrpc.getRawGetKeyTTLMethod(), factory, handler);
    return rawGetKeyTTLHelper(resp);
}
Also used : RawGetKeyTTLRequest(org.tikv.kvproto.Kvrpcpb.RawGetKeyTTLRequest) RawGetKeyTTLResponse(org.tikv.kvproto.Kvrpcpb.RawGetKeyTTLResponse) KVErrorHandler(com.pingcap.tikv.operation.KVErrorHandler)

Aggregations

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