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();
}
}
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);
}
Aggregations