• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 package io.grpc.alts.internal;
2 
3 import static io.grpc.MethodDescriptor.generateFullMethodName;
4 
5 /**
6  */
7 @javax.annotation.Generated(
8     value = "by gRPC proto compiler",
9     comments = "Source: grpc/gcp/handshaker.proto")
10 @io.grpc.stub.annotations.GrpcGenerated
11 public final class HandshakerServiceGrpc {
12 
HandshakerServiceGrpc()13   private HandshakerServiceGrpc() {}
14 
15   public static final String SERVICE_NAME = "grpc.gcp.HandshakerService";
16 
17   // Static method descriptors that strictly reflect the proto.
18   private static volatile io.grpc.MethodDescriptor<io.grpc.alts.internal.HandshakerReq,
19       io.grpc.alts.internal.HandshakerResp> getDoHandshakeMethod;
20 
21   @io.grpc.stub.annotations.RpcMethod(
22       fullMethodName = SERVICE_NAME + '/' + "DoHandshake",
23       requestType = io.grpc.alts.internal.HandshakerReq.class,
24       responseType = io.grpc.alts.internal.HandshakerResp.class,
25       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
26   public static io.grpc.MethodDescriptor<io.grpc.alts.internal.HandshakerReq,
getDoHandshakeMethod()27       io.grpc.alts.internal.HandshakerResp> getDoHandshakeMethod() {
28     io.grpc.MethodDescriptor<io.grpc.alts.internal.HandshakerReq, io.grpc.alts.internal.HandshakerResp> getDoHandshakeMethod;
29     if ((getDoHandshakeMethod = HandshakerServiceGrpc.getDoHandshakeMethod) == null) {
30       synchronized (HandshakerServiceGrpc.class) {
31         if ((getDoHandshakeMethod = HandshakerServiceGrpc.getDoHandshakeMethod) == null) {
32           HandshakerServiceGrpc.getDoHandshakeMethod = getDoHandshakeMethod =
33               io.grpc.MethodDescriptor.<io.grpc.alts.internal.HandshakerReq, io.grpc.alts.internal.HandshakerResp>newBuilder()
34               .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
35               .setFullMethodName(generateFullMethodName(SERVICE_NAME, "DoHandshake"))
36               .setSampledToLocalTracing(true)
37               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
38                   io.grpc.alts.internal.HandshakerReq.getDefaultInstance()))
39               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
40                   io.grpc.alts.internal.HandshakerResp.getDefaultInstance()))
41               .setSchemaDescriptor(new HandshakerServiceMethodDescriptorSupplier("DoHandshake"))
42               .build();
43         }
44       }
45     }
46     return getDoHandshakeMethod;
47   }
48 
49   /**
50    * Creates a new async stub that supports all call types for the service
51    */
newStub(io.grpc.Channel channel)52   public static HandshakerServiceStub newStub(io.grpc.Channel channel) {
53     io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceStub> factory =
54       new io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceStub>() {
55         @java.lang.Override
56         public HandshakerServiceStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
57           return new HandshakerServiceStub(channel, callOptions);
58         }
59       };
60     return HandshakerServiceStub.newStub(factory, channel);
61   }
62 
63   /**
64    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
65    */
newBlockingStub( io.grpc.Channel channel)66   public static HandshakerServiceBlockingStub newBlockingStub(
67       io.grpc.Channel channel) {
68     io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceBlockingStub> factory =
69       new io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceBlockingStub>() {
70         @java.lang.Override
71         public HandshakerServiceBlockingStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
72           return new HandshakerServiceBlockingStub(channel, callOptions);
73         }
74       };
75     return HandshakerServiceBlockingStub.newStub(factory, channel);
76   }
77 
78   /**
79    * Creates a new ListenableFuture-style stub that supports unary calls on the service
80    */
newFutureStub( io.grpc.Channel channel)81   public static HandshakerServiceFutureStub newFutureStub(
82       io.grpc.Channel channel) {
83     io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceFutureStub> factory =
84       new io.grpc.stub.AbstractStub.StubFactory<HandshakerServiceFutureStub>() {
85         @java.lang.Override
86         public HandshakerServiceFutureStub newStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
87           return new HandshakerServiceFutureStub(channel, callOptions);
88         }
89       };
90     return HandshakerServiceFutureStub.newStub(factory, channel);
91   }
92 
93   /**
94    */
95   public interface AsyncService {
96 
97     /**
98      * <pre>
99      * Handshaker service accepts a stream of handshaker request, returning a
100      * stream of handshaker response. Client is expected to send exactly one
101      * message with either client_start or server_start followed by one or more
102      * messages with next. Each time client sends a request, the handshaker
103      * service expects to respond. Client does not have to wait for service's
104      * response before sending next request.
105      * </pre>
106      */
doHandshake( io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp> responseObserver)107     default io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandshake(
108         io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp> responseObserver) {
109       return io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall(getDoHandshakeMethod(), responseObserver);
110     }
111   }
112 
113   /**
114    * Base class for the server implementation of the service HandshakerService.
115    */
116   public static abstract class HandshakerServiceImplBase
117       implements io.grpc.BindableService, AsyncService {
118 
bindService()119     @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
120       return HandshakerServiceGrpc.bindService(this);
121     }
122   }
123 
124   /**
125    * A stub to allow clients to do asynchronous rpc calls to service HandshakerService.
126    */
127   public static final class HandshakerServiceStub
128       extends io.grpc.stub.AbstractAsyncStub<HandshakerServiceStub> {
HandshakerServiceStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)129     private HandshakerServiceStub(
130         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
131       super(channel, callOptions);
132     }
133 
134     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)135     protected HandshakerServiceStub build(
136         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
137       return new HandshakerServiceStub(channel, callOptions);
138     }
139 
140     /**
141      * <pre>
142      * Handshaker service accepts a stream of handshaker request, returning a
143      * stream of handshaker response. Client is expected to send exactly one
144      * message with either client_start or server_start followed by one or more
145      * messages with next. Each time client sends a request, the handshaker
146      * service expects to respond. Client does not have to wait for service's
147      * response before sending next request.
148      * </pre>
149      */
doHandshake( io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp> responseObserver)150     public io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerReq> doHandshake(
151         io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp> responseObserver) {
152       return io.grpc.stub.ClientCalls.asyncBidiStreamingCall(
153           getChannel().newCall(getDoHandshakeMethod(), getCallOptions()), responseObserver);
154     }
155   }
156 
157   /**
158    * A stub to allow clients to do synchronous rpc calls to service HandshakerService.
159    */
160   public static final class HandshakerServiceBlockingStub
161       extends io.grpc.stub.AbstractBlockingStub<HandshakerServiceBlockingStub> {
HandshakerServiceBlockingStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)162     private HandshakerServiceBlockingStub(
163         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
164       super(channel, callOptions);
165     }
166 
167     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)168     protected HandshakerServiceBlockingStub build(
169         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
170       return new HandshakerServiceBlockingStub(channel, callOptions);
171     }
172   }
173 
174   /**
175    * A stub to allow clients to do ListenableFuture-style rpc calls to service HandshakerService.
176    */
177   public static final class HandshakerServiceFutureStub
178       extends io.grpc.stub.AbstractFutureStub<HandshakerServiceFutureStub> {
HandshakerServiceFutureStub( io.grpc.Channel channel, io.grpc.CallOptions callOptions)179     private HandshakerServiceFutureStub(
180         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
181       super(channel, callOptions);
182     }
183 
184     @java.lang.Override
build( io.grpc.Channel channel, io.grpc.CallOptions callOptions)185     protected HandshakerServiceFutureStub build(
186         io.grpc.Channel channel, io.grpc.CallOptions callOptions) {
187       return new HandshakerServiceFutureStub(channel, callOptions);
188     }
189   }
190 
191   private static final int METHODID_DO_HANDSHAKE = 0;
192 
193   private static final class MethodHandlers<Req, Resp> implements
194       io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
195       io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
196       io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
197       io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
198     private final AsyncService serviceImpl;
199     private final int methodId;
200 
MethodHandlers(AsyncService serviceImpl, int methodId)201     MethodHandlers(AsyncService serviceImpl, int methodId) {
202       this.serviceImpl = serviceImpl;
203       this.methodId = methodId;
204     }
205 
206     @java.lang.Override
207     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)208     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
209       switch (methodId) {
210         default:
211           throw new AssertionError();
212       }
213     }
214 
215     @java.lang.Override
216     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)217     public io.grpc.stub.StreamObserver<Req> invoke(
218         io.grpc.stub.StreamObserver<Resp> responseObserver) {
219       switch (methodId) {
220         case METHODID_DO_HANDSHAKE:
221           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.doHandshake(
222               (io.grpc.stub.StreamObserver<io.grpc.alts.internal.HandshakerResp>) responseObserver);
223         default:
224           throw new AssertionError();
225       }
226     }
227   }
228 
bindService(AsyncService service)229   public static final io.grpc.ServerServiceDefinition bindService(AsyncService service) {
230     return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
231         .addMethod(
232           getDoHandshakeMethod(),
233           io.grpc.stub.ServerCalls.asyncBidiStreamingCall(
234             new MethodHandlers<
235               io.grpc.alts.internal.HandshakerReq,
236               io.grpc.alts.internal.HandshakerResp>(
237                 service, METHODID_DO_HANDSHAKE)))
238         .build();
239   }
240 
241   private static abstract class HandshakerServiceBaseDescriptorSupplier
242       implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
HandshakerServiceBaseDescriptorSupplier()243     HandshakerServiceBaseDescriptorSupplier() {}
244 
245     @java.lang.Override
getFileDescriptor()246     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
247       return io.grpc.alts.internal.HandshakerProto.getDescriptor();
248     }
249 
250     @java.lang.Override
getServiceDescriptor()251     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
252       return getFileDescriptor().findServiceByName("HandshakerService");
253     }
254   }
255 
256   private static final class HandshakerServiceFileDescriptorSupplier
257       extends HandshakerServiceBaseDescriptorSupplier {
HandshakerServiceFileDescriptorSupplier()258     HandshakerServiceFileDescriptorSupplier() {}
259   }
260 
261   private static final class HandshakerServiceMethodDescriptorSupplier
262       extends HandshakerServiceBaseDescriptorSupplier
263       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
264     private final String methodName;
265 
HandshakerServiceMethodDescriptorSupplier(String methodName)266     HandshakerServiceMethodDescriptorSupplier(String methodName) {
267       this.methodName = methodName;
268     }
269 
270     @java.lang.Override
getMethodDescriptor()271     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
272       return getServiceDescriptor().findMethodByName(methodName);
273     }
274   }
275 
276   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
277 
getServiceDescriptor()278   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
279     io.grpc.ServiceDescriptor result = serviceDescriptor;
280     if (result == null) {
281       synchronized (HandshakerServiceGrpc.class) {
282         result = serviceDescriptor;
283         if (result == null) {
284           serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
285               .setSchemaDescriptor(new HandshakerServiceFileDescriptorSupplier())
286               .addMethod(getDoHandshakeMethod())
287               .build();
288         }
289       }
290     }
291     return result;
292   }
293 }
294