com.ibm.etcd.api.LockGrpc Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of etcd-java Show documentation
Show all versions of etcd-java Show documentation
etcd3 java client and utilities
package com.ibm.etcd.api;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
*
* The lock service exposes client-side locking facilities as a gRPC interface.
*
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.50.0)",
comments = "Source: v3lock.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class LockGrpc {
private LockGrpc() {}
public static final String SERVICE_NAME = "v3lockpb.Lock";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor getLockMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Lock",
requestType = com.ibm.etcd.api.LockRequest.class,
responseType = com.ibm.etcd.api.LockResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor getLockMethod() {
io.grpc.MethodDescriptor getLockMethod;
if ((getLockMethod = LockGrpc.getLockMethod) == null) {
synchronized (LockGrpc.class) {
if ((getLockMethod = LockGrpc.getLockMethod) == null) {
LockGrpc.getLockMethod = getLockMethod =
io.grpc.MethodDescriptor.newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Lock"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.ibm.etcd.api.LockRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.ibm.etcd.api.LockResponse.getDefaultInstance()))
.setSchemaDescriptor(new LockMethodDescriptorSupplier("Lock"))
.build();
}
}
}
return getLockMethod;
}
private static volatile io.grpc.MethodDescriptor getUnlockMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Unlock",
requestType = com.ibm.etcd.api.UnlockRequest.class,
responseType = com.ibm.etcd.api.UnlockResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor getUnlockMethod() {
io.grpc.MethodDescriptor getUnlockMethod;
if ((getUnlockMethod = LockGrpc.getUnlockMethod) == null) {
synchronized (LockGrpc.class) {
if ((getUnlockMethod = LockGrpc.getUnlockMethod) == null) {
LockGrpc.getUnlockMethod = getUnlockMethod =
io.grpc.MethodDescriptor.newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Unlock"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.ibm.etcd.api.UnlockRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.ibm.etcd.api.UnlockResponse.getDefaultInstance()))
.setSchemaDescriptor(new LockMethodDescriptorSupplier("Unlock"))
.build();
}
}
}
return getUnlockMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static LockStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public LockStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LockStub(channel, callOptions);
}
};
return LockStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static LockBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public LockBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LockBlockingStub(channel, callOptions);
}
};
return LockBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static LockFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public LockFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LockFutureStub(channel, callOptions);
}
};
return LockFutureStub.newStub(factory, channel);
}
/**
*
* The lock service exposes client-side locking facilities as a gRPC interface.
*
*/
public static abstract class LockImplBase implements io.grpc.BindableService {
/**
*
* Lock acquires a distributed shared lock on a given named lock.
* On success, it will return a unique key that exists so long as the
* lock is held by the caller. This key can be used in conjunction with
* transactions to safely ensure updates to etcd only occur while holding
* lock ownership. The lock is held until Unlock is called on the key or the
* lease associate with the owner expires.
*
*/
public void lock(com.ibm.etcd.api.LockRequest request,
io.grpc.stub.StreamObserver responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getLockMethod(), responseObserver);
}
/**
*
* Unlock takes a key returned by Lock and releases the hold on lock. The
* next Lock caller waiting for the lock will then be woken up and given
* ownership of the lock.
*
*/
public void unlock(com.ibm.etcd.api.UnlockRequest request,
io.grpc.stub.StreamObserver responseObserver) {
io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall(getUnlockMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getLockMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.ibm.etcd.api.LockRequest,
com.ibm.etcd.api.LockResponse>(
this, METHODID_LOCK)))
.addMethod(
getUnlockMethod(),
io.grpc.stub.ServerCalls.asyncUnaryCall(
new MethodHandlers<
com.ibm.etcd.api.UnlockRequest,
com.ibm.etcd.api.UnlockResponse>(
this, METHODID_UNLOCK)))
.build();
}
}
/**
*
* The lock service exposes client-side locking facilities as a gRPC interface.
*
*/
public static final class LockStub extends io.grpc.stub.AbstractAsyncStub {
private LockStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LockStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LockStub(channel, callOptions);
}
/**
*
* Lock acquires a distributed shared lock on a given named lock.
* On success, it will return a unique key that exists so long as the
* lock is held by the caller. This key can be used in conjunction with
* transactions to safely ensure updates to etcd only occur while holding
* lock ownership. The lock is held until Unlock is called on the key or the
* lease associate with the owner expires.
*
*/
public void lock(com.ibm.etcd.api.LockRequest request,
io.grpc.stub.StreamObserver responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getLockMethod(), getCallOptions()), request, responseObserver);
}
/**
*
* Unlock takes a key returned by Lock and releases the hold on lock. The
* next Lock caller waiting for the lock will then be woken up and given
* ownership of the lock.
*
*/
public void unlock(com.ibm.etcd.api.UnlockRequest request,
io.grpc.stub.StreamObserver responseObserver) {
io.grpc.stub.ClientCalls.asyncUnaryCall(
getChannel().newCall(getUnlockMethod(), getCallOptions()), request, responseObserver);
}
}
/**
*
* The lock service exposes client-side locking facilities as a gRPC interface.
*
*/
public static final class LockBlockingStub extends io.grpc.stub.AbstractBlockingStub {
private LockBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LockBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LockBlockingStub(channel, callOptions);
}
/**
*
* Lock acquires a distributed shared lock on a given named lock.
* On success, it will return a unique key that exists so long as the
* lock is held by the caller. This key can be used in conjunction with
* transactions to safely ensure updates to etcd only occur while holding
* lock ownership. The lock is held until Unlock is called on the key or the
* lease associate with the owner expires.
*
*/
public com.ibm.etcd.api.LockResponse lock(com.ibm.etcd.api.LockRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getLockMethod(), getCallOptions(), request);
}
/**
*
* Unlock takes a key returned by Lock and releases the hold on lock. The
* next Lock caller waiting for the lock will then be woken up and given
* ownership of the lock.
*
*/
public com.ibm.etcd.api.UnlockResponse unlock(com.ibm.etcd.api.UnlockRequest request) {
return io.grpc.stub.ClientCalls.blockingUnaryCall(
getChannel(), getUnlockMethod(), getCallOptions(), request);
}
}
/**
*
* The lock service exposes client-side locking facilities as a gRPC interface.
*
*/
public static final class LockFutureStub extends io.grpc.stub.AbstractFutureStub {
private LockFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected LockFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new LockFutureStub(channel, callOptions);
}
/**
*
* Lock acquires a distributed shared lock on a given named lock.
* On success, it will return a unique key that exists so long as the
* lock is held by the caller. This key can be used in conjunction with
* transactions to safely ensure updates to etcd only occur while holding
* lock ownership. The lock is held until Unlock is called on the key or the
* lease associate with the owner expires.
*
*/
public com.google.common.util.concurrent.ListenableFuture lock(
com.ibm.etcd.api.LockRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getLockMethod(), getCallOptions()), request);
}
/**
*
* Unlock takes a key returned by Lock and releases the hold on lock. The
* next Lock caller waiting for the lock will then be woken up and given
* ownership of the lock.
*
*/
public com.google.common.util.concurrent.ListenableFuture unlock(
com.ibm.etcd.api.UnlockRequest request) {
return io.grpc.stub.ClientCalls.futureUnaryCall(
getChannel().newCall(getUnlockMethod(), getCallOptions()), request);
}
}
private static final int METHODID_LOCK = 0;
private static final int METHODID_UNLOCK = 1;
private static final class MethodHandlers implements
io.grpc.stub.ServerCalls.UnaryMethod,
io.grpc.stub.ServerCalls.ServerStreamingMethod,
io.grpc.stub.ServerCalls.ClientStreamingMethod,
io.grpc.stub.ServerCalls.BidiStreamingMethod {
private final LockImplBase serviceImpl;
private final int methodId;
MethodHandlers(LockImplBase serviceImpl, int methodId) {
this.serviceImpl = serviceImpl;
this.methodId = methodId;
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public void invoke(Req request, io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
case METHODID_LOCK:
serviceImpl.lock((com.ibm.etcd.api.LockRequest) request,
(io.grpc.stub.StreamObserver) responseObserver);
break;
case METHODID_UNLOCK:
serviceImpl.unlock((com.ibm.etcd.api.UnlockRequest) request,
(io.grpc.stub.StreamObserver) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver invoke(
io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static abstract class LockBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
LockBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return com.ibm.etcd.api.V3Lock.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("Lock");
}
}
private static final class LockFileDescriptorSupplier
extends LockBaseDescriptorSupplier {
LockFileDescriptorSupplier() {}
}
private static final class LockMethodDescriptorSupplier
extends LockBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
LockMethodDescriptorSupplier(String methodName) {
this.methodName = methodName;
}
@java.lang.Override
public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
return getServiceDescriptor().findMethodByName(methodName);
}
}
private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
public static io.grpc.ServiceDescriptor getServiceDescriptor() {
io.grpc.ServiceDescriptor result = serviceDescriptor;
if (result == null) {
synchronized (LockGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new LockFileDescriptorSupplier())
.addMethod(getLockMethod())
.addMethod(getUnlockMethod())
.build();
}
}
}
return result;
}
}