org.hyperledger.fabric.protos.peer.ChaincodeGrpc Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fabric-sdk-java Show documentation
Show all versions of fabric-sdk-java Show documentation
Java SDK for Hyperledger Fabric. Deprecated as of Fabric v2.5, replaced by org.hyperledger.fabric:fabric-gateway.
package org.hyperledger.fabric.protos.peer;
import static io.grpc.MethodDescriptor.generateFullMethodName;
/**
*
* Chaincode as a server - peer establishes a connection to the chaincode as a client
* Currently only supports a stream connection.
*
*/
@javax.annotation.Generated(
value = "by gRPC proto compiler (version 1.56.0)",
comments = "Source: peer/chaincode_shim.proto")
@io.grpc.stub.annotations.GrpcGenerated
public final class ChaincodeGrpc {
private ChaincodeGrpc() {}
public static final String SERVICE_NAME = "protos.Chaincode";
// Static method descriptors that strictly reflect the proto.
private static volatile io.grpc.MethodDescriptor getConnectMethod;
@io.grpc.stub.annotations.RpcMethod(
fullMethodName = SERVICE_NAME + '/' + "Connect",
requestType = org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage.class,
responseType = org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage.class,
methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
public static io.grpc.MethodDescriptor getConnectMethod() {
io.grpc.MethodDescriptor getConnectMethod;
if ((getConnectMethod = ChaincodeGrpc.getConnectMethod) == null) {
synchronized (ChaincodeGrpc.class) {
if ((getConnectMethod = ChaincodeGrpc.getConnectMethod) == null) {
ChaincodeGrpc.getConnectMethod = getConnectMethod =
io.grpc.MethodDescriptor.newBuilder()
.setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
.setFullMethodName(generateFullMethodName(SERVICE_NAME, "Connect"))
.setSampledToLocalTracing(true)
.setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage.getDefaultInstance()))
.setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage.getDefaultInstance()))
.setSchemaDescriptor(new ChaincodeMethodDescriptorSupplier("Connect"))
.build();
}
}
}
return getConnectMethod;
}
/**
* Creates a new async stub that supports all call types for the service
*/
public static ChaincodeStub newStub(io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public ChaincodeStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ChaincodeStub(channel, callOptions);
}
};
return ChaincodeStub.newStub(factory, channel);
}
/**
* Creates a new blocking-style stub that supports unary and streaming output calls on the service
*/
public static ChaincodeBlockingStub newBlockingStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public ChaincodeBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ChaincodeBlockingStub(channel, callOptions);
}
};
return ChaincodeBlockingStub.newStub(factory, channel);
}
/**
* Creates a new ListenableFuture-style stub that supports unary calls on the service
*/
public static ChaincodeFutureStub newFutureStub(
io.grpc.Channel channel) {
io.grpc.stub.AbstractStub.StubFactory factory =
new io.grpc.stub.AbstractStub.StubFactory() {
@java.lang.Override
public ChaincodeFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ChaincodeFutureStub(channel, callOptions);
}
};
return ChaincodeFutureStub.newStub(factory, channel);
}
/**
*
* Chaincode as a server - peer establishes a connection to the chaincode as a client
* Currently only supports a stream connection.
*
*/
public interface AsyncService {
/**
*/
default io.grpc.stub.StreamObserver connect(
io.grpc.stub.StreamObserver responseObserver) {
return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getConnectMethod(), responseObserver);
}
}
/**
* Base class for the server implementation of the service Chaincode.
*
* Chaincode as a server - peer establishes a connection to the chaincode as a client
* Currently only supports a stream connection.
*
*/
public static abstract class ChaincodeImplBase
implements io.grpc.BindableService, AsyncService {
@java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
return ChaincodeGrpc.bindService(this);
}
}
/**
* A stub to allow clients to do asynchronous rpc calls to service Chaincode.
*
* Chaincode as a server - peer establishes a connection to the chaincode as a client
* Currently only supports a stream connection.
*
*/
public static final class ChaincodeStub
extends io.grpc.stub.AbstractAsyncStub {
private ChaincodeStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ChaincodeStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ChaincodeStub(channel, callOptions);
}
/**
*/
public io.grpc.stub.StreamObserver connect(
io.grpc.stub.StreamObserver responseObserver) {
return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
getChannel().newCall(getConnectMethod(), getCallOptions()), responseObserver);
}
}
/**
* A stub to allow clients to do synchronous rpc calls to service Chaincode.
*
* Chaincode as a server - peer establishes a connection to the chaincode as a client
* Currently only supports a stream connection.
*
*/
public static final class ChaincodeBlockingStub
extends io.grpc.stub.AbstractBlockingStub {
private ChaincodeBlockingStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ChaincodeBlockingStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ChaincodeBlockingStub(channel, callOptions);
}
}
/**
* A stub to allow clients to do ListenableFuture-style rpc calls to service Chaincode.
*
* Chaincode as a server - peer establishes a connection to the chaincode as a client
* Currently only supports a stream connection.
*
*/
public static final class ChaincodeFutureStub
extends io.grpc.stub.AbstractFutureStub {
private ChaincodeFutureStub(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
super(channel, callOptions);
}
@java.lang.Override
protected ChaincodeFutureStub build(
io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
return new ChaincodeFutureStub(channel, callOptions);
}
}
private static final int METHODID_CONNECT = 0;
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 AsyncService serviceImpl;
private final int methodId;
MethodHandlers(AsyncService 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) {
default:
throw new AssertionError();
}
}
@java.lang.Override
@java.lang.SuppressWarnings("unchecked")
public io.grpc.stub.StreamObserver invoke(
io.grpc.stub.StreamObserver responseObserver) {
switch (methodId) {
case METHODID_CONNECT:
return (io.grpc.stub.StreamObserver) serviceImpl.connect(
(io.grpc.stub.StreamObserver) responseObserver);
default:
throw new AssertionError();
}
}
}
public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
.addMethod(
getConnectMethod(),
io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
new MethodHandlers<
org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage,
org.hyperledger.fabric.protos.peer.ChaincodeShim.ChaincodeMessage>(
service, METHODID_CONNECT)))
.build();
}
private static abstract class ChaincodeBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
ChaincodeBaseDescriptorSupplier() {}
@java.lang.Override
public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
return org.hyperledger.fabric.protos.peer.ChaincodeShim.getDescriptor();
}
@java.lang.Override
public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
return getFileDescriptor().findServiceByName("Chaincode");
}
}
private static final class ChaincodeFileDescriptorSupplier
extends ChaincodeBaseDescriptorSupplier {
ChaincodeFileDescriptorSupplier() {}
}
private static final class ChaincodeMethodDescriptorSupplier
extends ChaincodeBaseDescriptorSupplier
implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
private final String methodName;
ChaincodeMethodDescriptorSupplier(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 (ChaincodeGrpc.class) {
result = serviceDescriptor;
if (result == null) {
serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
.setSchemaDescriptor(new ChaincodeFileDescriptorSupplier())
.addMethod(getConnectMethod())
.build();
}
}
}
return result;
}
}