use of io.etcd.jetcd.support.Errors in project jetcd by coreos.
the class KVImpl method get.
@Override
public CompletableFuture<GetResponse> get(ByteSequence key, GetOption option) {
checkNotNull(key, "key should not be null");
checkNotNull(option, "option should not be null");
return execute(() -> stub.range(Requests.mapRangeRequest(key, option, namespace)), response -> new GetResponse(response, namespace), Errors::isRetryable);
}
use of io.etcd.jetcd.support.Errors in project jetcd by coreos.
the class KVImpl method compact.
@Override
public CompletableFuture<CompactResponse> compact(long rev, CompactOption option) {
checkNotNull(option, "option should not be null");
CompactionRequest request = CompactionRequest.newBuilder().setRevision(rev).setPhysical(option.isPhysical()).build();
return execute(() -> stub.compact(request), CompactResponse::new, Errors::isRetryable);
}
use of io.etcd.jetcd.support.Errors in project jetcd by coreos.
the class KVImpl method put.
@Override
public CompletableFuture<PutResponse> put(ByteSequence key, ByteSequence value, PutOption option) {
checkNotNull(key, "key should not be null");
checkNotNull(value, "value should not be null");
checkNotNull(option, "option should not be null");
return execute(() -> stub.put(Requests.mapPutRequest(key, value, option, namespace)), response -> new PutResponse(response, namespace), Errors::isRetryable);
}
use of io.etcd.jetcd.support.Errors in project jetcd by coreos.
the class KVImpl method delete.
@Override
public CompletableFuture<DeleteResponse> delete(ByteSequence key, DeleteOption option) {
checkNotNull(key, "key should not be null");
checkNotNull(option, "option should not be null");
return execute(() -> stub.deleteRange(Requests.mapDeleteRequest(key, option, namespace)), response -> new DeleteResponse(response, namespace), Errors::isRetryable);
}
use of io.etcd.jetcd.support.Errors in project jetcd by coreos.
the class LockImpl method lock.
@Override
public CompletableFuture<LockResponse> lock(ByteSequence name, long leaseId) {
checkNotNull(name);
LockRequest request = LockRequest.newBuilder().setName(Util.prefixNamespace(name, namespace)).setLease(leaseId).build();
return execute(() -> stub.lock(request), response -> new LockResponse(response, namespace), Errors::isRetryable);
}
Aggregations