bdledger-java-sdk/src/main/java/bdledger/api/grpc/ledger/TransactionLedgerGrpc.java
2020-02-07 19:53:44 +08:00

437 lines
19 KiB
Java

package bdledger.api.grpc.ledger;
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;
/**
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.27.0)",
comments = "Source: bdledger/api/ledger.proto")
public final class TransactionLedgerGrpc {
private TransactionLedgerGrpc() {}
public static final String SERVICE_NAME = "bdledger.api.TransactionLedger";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.CreateLedgerRequest,
bdledger.api.grpc.ledger.CreateLedgerResponse> getCreateLedgerMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "CreateLedger",
requestType = bdledger.api.grpc.ledger.CreateLedgerRequest.class,
responseType = bdledger.api.grpc.ledger.CreateLedgerResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.CreateLedgerRequest,
bdledger.api.grpc.ledger.CreateLedgerResponse> getCreateLedgerMethod() {
io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.CreateLedgerRequest, bdledger.api.grpc.ledger.CreateLedgerResponse> getCreateLedgerMethod;
if ((getCreateLedgerMethod = TransactionLedgerGrpc.getCreateLedgerMethod) == null) {
synchronized (TransactionLedgerGrpc.class) {
if ((getCreateLedgerMethod = TransactionLedgerGrpc.getCreateLedgerMethod) == null) {
TransactionLedgerGrpc.getCreateLedgerMethod = getCreateLedgerMethod =
io.grpc.MethodDescriptor.<bdledger.api.grpc.ledger.CreateLedgerRequest, bdledger.api.grpc.ledger.CreateLedgerResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "CreateLedger"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
bdledger.api.grpc.ledger.CreateLedgerRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
bdledger.api.grpc.ledger.CreateLedgerResponse.getDefaultInstance()))
.setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("CreateLedger"))
.build();
}
}
}
return getCreateLedgerMethod;
}
private static volatile io.grpc.MethodDescriptor<com.google.protobuf.Empty,
bdledger.api.grpc.ledger.GetLedgersResponse> getGetLedgersMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "GetLedgers",
requestType = com.google.protobuf.Empty.class,
responseType = bdledger.api.grpc.ledger.GetLedgersResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<com.google.protobuf.Empty,
bdledger.api.grpc.ledger.GetLedgersResponse> getGetLedgersMethod() {
io.grpc.MethodDescriptor<com.google.protobuf.Empty, bdledger.api.grpc.ledger.GetLedgersResponse> getGetLedgersMethod;
if ((getGetLedgersMethod = TransactionLedgerGrpc.getGetLedgersMethod) == null) {
synchronized (TransactionLedgerGrpc.class) {
if ((getGetLedgersMethod = TransactionLedgerGrpc.getGetLedgersMethod) == null) {
TransactionLedgerGrpc.getGetLedgersMethod = getGetLedgersMethod =
io.grpc.MethodDescriptor.<com.google.protobuf.Empty, bdledger.api.grpc.ledger.GetLedgersResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "GetLedgers"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
com.google.protobuf.Empty.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
bdledger.api.grpc.ledger.GetLedgersResponse.getDefaultInstance()))
.setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("GetLedgers"))
.build();
}
}
}
return getGetLedgersMethod;
}
private static volatile io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.SendTransactionRequest,
bdledger.api.grpc.ledger.SendTransactionResponse> getSendTransactionMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "SendTransaction",
requestType = bdledger.api.grpc.ledger.SendTransactionRequest.class,
responseType = bdledger.api.grpc.ledger.SendTransactionResponse.class,
methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
public static io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.SendTransactionRequest,
bdledger.api.grpc.ledger.SendTransactionResponse> getSendTransactionMethod() {
io.grpc.MethodDescriptor<bdledger.api.grpc.ledger.SendTransactionRequest, bdledger.api.grpc.ledger.SendTransactionResponse> getSendTransactionMethod;
if ((getSendTransactionMethod = TransactionLedgerGrpc.getSendTransactionMethod) == null) {
synchronized (TransactionLedgerGrpc.class) {
if ((getSendTransactionMethod = TransactionLedgerGrpc.getSendTransactionMethod) == null) {
TransactionLedgerGrpc.getSendTransactionMethod = getSendTransactionMethod =
io.grpc.MethodDescriptor.<bdledger.api.grpc.ledger.SendTransactionRequest, bdledger.api.grpc.ledger.SendTransactionResponse>newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.UNARY)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "SendTransaction"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
bdledger.api.grpc.ledger.SendTransactionRequest.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
bdledger.api.grpc.ledger.SendTransactionResponse.getDefaultInstance()))
.setSchemaDescriptor(new TransactionLedgerMethodDescriptorSupplier("SendTransaction"))
.build();
}
}
}
return getSendTransactionMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static TransactionLedgerStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerStub>() {
@java.lang.Override
public TransactionLedgerStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerStub(channel, callOptions);
}
};
return TransactionLedgerStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static TransactionLedgerBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerBlockingStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerBlockingStub>() {
@java.lang.Override
public TransactionLedgerBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerBlockingStub(channel, callOptions);
}
};
return TransactionLedgerBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static TransactionLedgerFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerFutureStub> factory =
new io.grpc.stub.AbstractStub.StubFactory<TransactionLedgerFutureStub>() {
@java.lang.Override
public TransactionLedgerFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerFutureStub(channel, callOptions);
}
};
return TransactionLedgerFutureStub.newStub(factory, channel);
}
/**
*/
public static abstract class TransactionLedgerImplBase implements io.grpc.BindableService {
/**
*/
public void createLedger(bdledger.api.grpc.ledger.CreateLedgerRequest request,
io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.CreateLedgerResponse> responseObserver) {
asyncUnimplementedUnaryCall(getCreateLedgerMethod(), responseObserver);
}
/**
*/
public void getLedgers(com.google.protobuf.Empty request,
io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.GetLedgersResponse> responseObserver) {
asyncUnimplementedUnaryCall(getGetLedgersMethod(), responseObserver);
}
/**
*/
public void sendTransaction(bdledger.api.grpc.ledger.SendTransactionRequest request,
io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.SendTransactionResponse> responseObserver) {
asyncUnimplementedUnaryCall(getSendTransactionMethod(), responseObserver);
}
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getCreateLedgerMethod(),
asyncUnaryCall(
new MethodHandlers<
bdledger.api.grpc.ledger.CreateLedgerRequest,
bdledger.api.grpc.ledger.CreateLedgerResponse>(
this, METHODID_CREATE_LEDGER)))
.addMethod(
getGetLedgersMethod(),
asyncUnaryCall(
new MethodHandlers<
com.google.protobuf.Empty,
bdledger.api.grpc.ledger.GetLedgersResponse>(
this, METHODID_GET_LEDGERS)))
.addMethod(
getSendTransactionMethod(),
asyncUnaryCall(
new MethodHandlers<
bdledger.api.grpc.ledger.SendTransactionRequest,
bdledger.api.grpc.ledger.SendTransactionResponse>(
this, METHODID_SEND_TRANSACTION)))
.build();
}
}
/**
*/
public static final class TransactionLedgerStub extends io.grpc.stub.AbstractAsyncStub<TransactionLedgerStub> {
private TransactionLedgerStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TransactionLedgerStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerStub(channel, callOptions);
}
/**
*/
public void createLedger(bdledger.api.grpc.ledger.CreateLedgerRequest request,
io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.CreateLedgerResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getCreateLedgerMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void getLedgers(com.google.protobuf.Empty request,
io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.GetLedgersResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getGetLedgersMethod(), getCallOptions()), request, responseObserver);
}
/**
*/
public void sendTransaction(bdledger.api.grpc.ledger.SendTransactionRequest request,
io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.SendTransactionResponse> responseObserver) {
asyncUnaryCall(
getChannel().newCall(getSendTransactionMethod(), getCallOptions()), request, responseObserver);
}
}
/**
*/
public static final class TransactionLedgerBlockingStub extends io.grpc.stub.AbstractBlockingStub<TransactionLedgerBlockingStub> {
private TransactionLedgerBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TransactionLedgerBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerBlockingStub(channel, callOptions);
}
/**
*/
public bdledger.api.grpc.ledger.CreateLedgerResponse createLedger(bdledger.api.grpc.ledger.CreateLedgerRequest request) {
return blockingUnaryCall(
getChannel(), getCreateLedgerMethod(), getCallOptions(), request);
}
/**
*/
public bdledger.api.grpc.ledger.GetLedgersResponse getLedgers(com.google.protobuf.Empty request) {
return blockingUnaryCall(
getChannel(), getGetLedgersMethod(), getCallOptions(), request);
}
/**
*/
public bdledger.api.grpc.ledger.SendTransactionResponse sendTransaction(bdledger.api.grpc.ledger.SendTransactionRequest request) {
return blockingUnaryCall(
getChannel(), getSendTransactionMethod(), getCallOptions(), request);
}
}
/**
*/
public static final class TransactionLedgerFutureStub extends io.grpc.stub.AbstractFutureStub<TransactionLedgerFutureStub> {
private TransactionLedgerFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected TransactionLedgerFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new TransactionLedgerFutureStub(channel, callOptions);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<bdledger.api.grpc.ledger.CreateLedgerResponse> createLedger(
bdledger.api.grpc.ledger.CreateLedgerRequest request) {
return futureUnaryCall(
getChannel().newCall(getCreateLedgerMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<bdledger.api.grpc.ledger.GetLedgersResponse> getLedgers(
com.google.protobuf.Empty request) {
return futureUnaryCall(
getChannel().newCall(getGetLedgersMethod(), getCallOptions()), request);
}
/**
*/
public com.google.common.util.concurrent.ListenableFuture<bdledger.api.grpc.ledger.SendTransactionResponse> sendTransaction(
bdledger.api.grpc.ledger.SendTransactionRequest request) {
return futureUnaryCall(
getChannel().newCall(getSendTransactionMethod(), getCallOptions()), request);
}
}
private static final int METHODID_CREATE_LEDGER = 0;
private static final int METHODID_GET_LEDGERS = 1;
private static final int METHODID_SEND_TRANSACTION = 2;
private static final class MethodHandlers<Req, Resp> implements
io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
private final TransactionLedgerImplBase serviceImpl;
private final int methodId;
MethodHandlers(TransactionLedgerImplBase 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<Resp> responseObserver) {
switch (methodId) {
case METHODID_CREATE_LEDGER:
serviceImpl.createLedger((bdledger.api.grpc.ledger.CreateLedgerRequest) request,
(io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.CreateLedgerResponse>) responseObserver);
break;
case METHODID_GET_LEDGERS:
serviceImpl.getLedgers((com.google.protobuf.Empty) request,
(io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.GetLedgersResponse>) responseObserver);
break;
case METHODID_SEND_TRANSACTION:
serviceImpl.sendTransaction((bdledger.api.grpc.ledger.SendTransactionRequest) request,
(io.grpc.stub.StreamObserver<bdledger.api.grpc.ledger.SendTransactionResponse>) responseObserver);
break;
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver<Req> invoke(
io.grpc.stub.StreamObserver<Resp> responseObserver) {
switch (methodId) {
default:
throw new AssertionError();
}
}
}
private static abstract class TransactionLedgerBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
TransactionLedgerBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return bdledger.api.grpc.ledger.LedgerProto.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("TransactionLedger");
}
}
private static final class TransactionLedgerFileDescriptorSupplier
extends TransactionLedgerBaseDescriptorSupplier {
TransactionLedgerFileDescriptorSupplier() {}
}
private static final class TransactionLedgerMethodDescriptorSupplier
extends TransactionLedgerBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
TransactionLedgerMethodDescriptorSupplier(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 (TransactionLedgerGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new TransactionLedgerFileDescriptorSupplier())
.addMethod(getCreateLedgerMethod())
.addMethod(getGetLedgersMethod())
.addMethod(getSendTransactionMethod())
.build();
}
}
}
return result;
}
}