
io.etcd.jetcd.api.lock.LockGrpc Maven / Gradle / Ivy
The newest version!
package io.etcd.jetcd.api.lock;
import static io.grpc.MethodDescriptor.generateFullMethodName;
import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
import static io.grpc.stub.ClientCalls.asyncUnaryCall;
import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
import static io.grpc.stub.ClientCalls.blockingUnaryCall;
import static io.grpc.stub.ClientCalls.futureUnaryCall;
import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnaryCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
/**
*
* The lock service exposes client-side locking facilities as a gRPC interface.
*
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.18.0)",
comments = "Source: lock.proto")
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 = io.etcd.jetcd.api.lock.LockRequest.class,
responseType = io.etcd.jetcd.api.lock.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(
"v3lockpb.Lock", "Lock"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.etcd.jetcd.api.lock.LockRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.etcd.jetcd.api.lock.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 = io.etcd.jetcd.api.lock.UnlockRequest.class,
responseType = io.etcd.jetcd.api.lock.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(
"v3lockpb.Lock", "Unlock"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.etcd.jetcd.api.lock.UnlockRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
io.etcd.jetcd.api.lock.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) {
return new LockStub(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) {
return new LockBlockingStub(channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static LockFutureStub newFutureStub(
io.grpc.Channel channel) {
return new LockFutureStub(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(io.etcd.jetcd.api.lock.LockRequest request,
io.grpc.stub.StreamObserver responseObserver) {
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(io.etcd.jetcd.api.lock.UnlockRequest request,
io.grpc.stub.StreamObserver responseObserver) {
asyncUnimplementedUnaryCall(getUnlockMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getLockMethod(),
asyncUnaryCall(
new MethodHandlers<
io.etcd.jetcd.api.lock.LockRequest,
io.etcd.jetcd.api.lock.LockResponse>(
this, METHODID_LOCK)))
.addMethod(
getUnlockMethod(),
asyncUnaryCall(
new MethodHandlers<
io.etcd.jetcd.api.lock.UnlockRequest,
io.etcd.jetcd.api.lock.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.AbstractStub {
private LockStub(io.grpc.Channel channel) {
super(channel);
}
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(io.etcd.jetcd.api.lock.LockRequest request,
io.grpc.stub.StreamObserver responseObserver) {
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(io.etcd.jetcd.api.lock.UnlockRequest request,
io.grpc.stub.StreamObserver responseObserver) {
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.AbstractStub {
private LockBlockingStub(io.grpc.Channel channel) {
super(channel);
}
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 io.etcd.jetcd.api.lock.LockResponse lock(io.etcd.jetcd.api.lock.LockRequest request) {
return 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 io.etcd.jetcd.api.lock.UnlockResponse unlock(io.etcd.jetcd.api.lock.UnlockRequest request) {
return 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.AbstractStub {
private LockFutureStub(io.grpc.Channel channel) {
super(channel);
}
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(
io.etcd.jetcd.api.lock.LockRequest request) {
return 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(
io.etcd.jetcd.api.lock.UnlockRequest request) {
return 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((io.etcd.jetcd.api.lock.LockRequest) request,
(io.grpc.stub.StreamObserver) responseObserver);
break;
case METHODID_UNLOCK:
serviceImpl.unlock((io.etcd.jetcd.api.lock.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 io.etcd.jetcd.api.lock.JetcdProto.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;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy