1 package io.grpc.testing.integration;
2 
3 import static io.grpc.MethodDescriptor.generateFullMethodName;
4 import static io.grpc.stub.ClientCalls.asyncBidiStreamingCall;
5 import static io.grpc.stub.ClientCalls.asyncClientStreamingCall;
6 import static io.grpc.stub.ClientCalls.asyncServerStreamingCall;
7 import static io.grpc.stub.ClientCalls.asyncUnaryCall;
8 import static io.grpc.stub.ClientCalls.blockingServerStreamingCall;
9 import static io.grpc.stub.ClientCalls.blockingUnaryCall;
10 import static io.grpc.stub.ClientCalls.futureUnaryCall;
11 import static io.grpc.stub.ServerCalls.asyncBidiStreamingCall;
12 import static io.grpc.stub.ServerCalls.asyncClientStreamingCall;
13 import static io.grpc.stub.ServerCalls.asyncServerStreamingCall;
14 import static io.grpc.stub.ServerCalls.asyncUnaryCall;
15 import static io.grpc.stub.ServerCalls.asyncUnimplementedStreamingCall;
16 import static io.grpc.stub.ServerCalls.asyncUnimplementedUnaryCall;
17 
18 /**
19  */
20 @javax.annotation.Generated(
21     value = "by gRPC proto compiler",
22     comments = "Source: grpc/testing/metrics.proto")
23 public final class MetricsServiceGrpc {
24 
MetricsServiceGrpc()25   private MetricsServiceGrpc() {}
26 
27   public static final String SERVICE_NAME = "grpc.testing.MetricsService";
28 
29   // Static method descriptors that strictly reflect the proto.
30   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage,
31       io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod;
32 
33   @io.grpc.stub.annotations.RpcMethod(
34       fullMethodName = SERVICE_NAME + '/' + "GetAllGauges",
35       requestType = io.grpc.testing.integration.Metrics.EmptyMessage.class,
36       responseType = io.grpc.testing.integration.Metrics.GaugeResponse.class,
37       methodType = io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
38   public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage,
getGetAllGaugesMethod()39       io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod() {
40     io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.EmptyMessage, io.grpc.testing.integration.Metrics.GaugeResponse> getGetAllGaugesMethod;
41     if ((getGetAllGaugesMethod = MetricsServiceGrpc.getGetAllGaugesMethod) == null) {
42       synchronized (MetricsServiceGrpc.class) {
43         if ((getGetAllGaugesMethod = MetricsServiceGrpc.getGetAllGaugesMethod) == null) {
44           MetricsServiceGrpc.getGetAllGaugesMethod = getGetAllGaugesMethod =
45               io.grpc.MethodDescriptor.<io.grpc.testing.integration.Metrics.EmptyMessage, io.grpc.testing.integration.Metrics.GaugeResponse>newBuilder()
46               .setType(io.grpc.MethodDescriptor.MethodType.SERVER_STREAMING)
47               .setFullMethodName(generateFullMethodName(
48                   "grpc.testing.MetricsService", "GetAllGauges"))
49               .setSampledToLocalTracing(true)
50               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
51                   io.grpc.testing.integration.Metrics.EmptyMessage.getDefaultInstance()))
52               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
53                   io.grpc.testing.integration.Metrics.GaugeResponse.getDefaultInstance()))
54                   .setSchemaDescriptor(new MetricsServiceMethodDescriptorSupplier("GetAllGauges"))
55                   .build();
56           }
57         }
58      }
59      return getGetAllGaugesMethod;
60   }
61 
62   private static volatile io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest,
63       io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod;
64 
65   @io.grpc.stub.annotations.RpcMethod(
66       fullMethodName = SERVICE_NAME + '/' + "GetGauge",
67       requestType = io.grpc.testing.integration.Metrics.GaugeRequest.class,
68       responseType = io.grpc.testing.integration.Metrics.GaugeResponse.class,
69       methodType = io.grpc.MethodDescriptor.MethodType.UNARY)
70   public static io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest,
getGetGaugeMethod()71       io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod() {
72     io.grpc.MethodDescriptor<io.grpc.testing.integration.Metrics.GaugeRequest, io.grpc.testing.integration.Metrics.GaugeResponse> getGetGaugeMethod;
73     if ((getGetGaugeMethod = MetricsServiceGrpc.getGetGaugeMethod) == null) {
74       synchronized (MetricsServiceGrpc.class) {
75         if ((getGetGaugeMethod = MetricsServiceGrpc.getGetGaugeMethod) == null) {
76           MetricsServiceGrpc.getGetGaugeMethod = getGetGaugeMethod =
77               io.grpc.MethodDescriptor.<io.grpc.testing.integration.Metrics.GaugeRequest, io.grpc.testing.integration.Metrics.GaugeResponse>newBuilder()
78               .setType(io.grpc.MethodDescriptor.MethodType.UNARY)
79               .setFullMethodName(generateFullMethodName(
80                   "grpc.testing.MetricsService", "GetGauge"))
81               .setSampledToLocalTracing(true)
82               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
83                   io.grpc.testing.integration.Metrics.GaugeRequest.getDefaultInstance()))
84               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
85                   io.grpc.testing.integration.Metrics.GaugeResponse.getDefaultInstance()))
86                   .setSchemaDescriptor(new MetricsServiceMethodDescriptorSupplier("GetGauge"))
87                   .build();
88           }
89         }
90      }
91      return getGetGaugeMethod;
92   }
93 
94   /**
95    * Creates a new async stub that supports all call types for the service
96    */
newStub(io.grpc.Channel channel)97   public static MetricsServiceStub newStub(io.grpc.Channel channel) {
98     return new MetricsServiceStub(channel);
99   }
100 
101   /**
102    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
103    */
newBlockingStub( io.grpc.Channel channel)104   public static MetricsServiceBlockingStub newBlockingStub(
105       io.grpc.Channel channel) {
106     return new MetricsServiceBlockingStub(channel);
107   }
108 
109   /**
110    * Creates a new ListenableFuture-style stub that supports unary calls on the service
111    */
newFutureStub( io.grpc.Channel channel)112   public static MetricsServiceFutureStub newFutureStub(
113       io.grpc.Channel channel) {
114     return new MetricsServiceFutureStub(channel);
115   }
116 
117   /**
118    */
119   public static abstract class MetricsServiceImplBase implements io.grpc.BindableService {
120 
121     /**
122      * <pre>
123      * Returns the values of all the gauges that are currently being maintained by
124      * the service
125      * </pre>
126      */
getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request, io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver)127     public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
128         io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
129       asyncUnimplementedUnaryCall(getGetAllGaugesMethod(), responseObserver);
130     }
131 
132     /**
133      * <pre>
134      * Returns the value of one gauge
135      * </pre>
136      */
getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request, io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver)137     public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
138         io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
139       asyncUnimplementedUnaryCall(getGetGaugeMethod(), responseObserver);
140     }
141 
bindService()142     @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
143       return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
144           .addMethod(
145             getGetAllGaugesMethod(),
146             asyncServerStreamingCall(
147               new MethodHandlers<
148                 io.grpc.testing.integration.Metrics.EmptyMessage,
149                 io.grpc.testing.integration.Metrics.GaugeResponse>(
150                   this, METHODID_GET_ALL_GAUGES)))
151           .addMethod(
152             getGetGaugeMethod(),
153             asyncUnaryCall(
154               new MethodHandlers<
155                 io.grpc.testing.integration.Metrics.GaugeRequest,
156                 io.grpc.testing.integration.Metrics.GaugeResponse>(
157                   this, METHODID_GET_GAUGE)))
158           .build();
159     }
160   }
161 
162   /**
163    */
164   public static final class MetricsServiceStub extends io.grpc.stub.AbstractStub<MetricsServiceStub> {
MetricsServiceStub(io.grpc.Channel channel)165     private MetricsServiceStub(io.grpc.Channel channel) {
166       super(channel);
167     }
168 
MetricsServiceStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)169     private MetricsServiceStub(io.grpc.Channel channel,
170         io.grpc.CallOptions callOptions) {
171       super(channel, callOptions);
172     }
173 
174     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)175     protected MetricsServiceStub build(io.grpc.Channel channel,
176         io.grpc.CallOptions callOptions) {
177       return new MetricsServiceStub(channel, callOptions);
178     }
179 
180     /**
181      * <pre>
182      * Returns the values of all the gauges that are currently being maintained by
183      * the service
184      * </pre>
185      */
getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request, io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver)186     public void getAllGauges(io.grpc.testing.integration.Metrics.EmptyMessage request,
187         io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
188       asyncServerStreamingCall(
189           getChannel().newCall(getGetAllGaugesMethod(), getCallOptions()), request, responseObserver);
190     }
191 
192     /**
193      * <pre>
194      * Returns the value of one gauge
195      * </pre>
196      */
getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request, io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver)197     public void getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request,
198         io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse> responseObserver) {
199       asyncUnaryCall(
200           getChannel().newCall(getGetGaugeMethod(), getCallOptions()), request, responseObserver);
201     }
202   }
203 
204   /**
205    */
206   public static final class MetricsServiceBlockingStub extends io.grpc.stub.AbstractStub<MetricsServiceBlockingStub> {
MetricsServiceBlockingStub(io.grpc.Channel channel)207     private MetricsServiceBlockingStub(io.grpc.Channel channel) {
208       super(channel);
209     }
210 
MetricsServiceBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)211     private MetricsServiceBlockingStub(io.grpc.Channel channel,
212         io.grpc.CallOptions callOptions) {
213       super(channel, callOptions);
214     }
215 
216     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)217     protected MetricsServiceBlockingStub build(io.grpc.Channel channel,
218         io.grpc.CallOptions callOptions) {
219       return new MetricsServiceBlockingStub(channel, callOptions);
220     }
221 
222     /**
223      * <pre>
224      * Returns the values of all the gauges that are currently being maintained by
225      * the service
226      * </pre>
227      */
getAllGauges( io.grpc.testing.integration.Metrics.EmptyMessage request)228     public java.util.Iterator<io.grpc.testing.integration.Metrics.GaugeResponse> getAllGauges(
229         io.grpc.testing.integration.Metrics.EmptyMessage request) {
230       return blockingServerStreamingCall(
231           getChannel(), getGetAllGaugesMethod(), getCallOptions(), request);
232     }
233 
234     /**
235      * <pre>
236      * Returns the value of one gauge
237      * </pre>
238      */
getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request)239     public io.grpc.testing.integration.Metrics.GaugeResponse getGauge(io.grpc.testing.integration.Metrics.GaugeRequest request) {
240       return blockingUnaryCall(
241           getChannel(), getGetGaugeMethod(), getCallOptions(), request);
242     }
243   }
244 
245   /**
246    */
247   public static final class MetricsServiceFutureStub extends io.grpc.stub.AbstractStub<MetricsServiceFutureStub> {
MetricsServiceFutureStub(io.grpc.Channel channel)248     private MetricsServiceFutureStub(io.grpc.Channel channel) {
249       super(channel);
250     }
251 
MetricsServiceFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)252     private MetricsServiceFutureStub(io.grpc.Channel channel,
253         io.grpc.CallOptions callOptions) {
254       super(channel, callOptions);
255     }
256 
257     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)258     protected MetricsServiceFutureStub build(io.grpc.Channel channel,
259         io.grpc.CallOptions callOptions) {
260       return new MetricsServiceFutureStub(channel, callOptions);
261     }
262 
263     /**
264      * <pre>
265      * Returns the value of one gauge
266      * </pre>
267      */
getGauge( io.grpc.testing.integration.Metrics.GaugeRequest request)268     public com.google.common.util.concurrent.ListenableFuture<io.grpc.testing.integration.Metrics.GaugeResponse> getGauge(
269         io.grpc.testing.integration.Metrics.GaugeRequest request) {
270       return futureUnaryCall(
271           getChannel().newCall(getGetGaugeMethod(), getCallOptions()), request);
272     }
273   }
274 
275   private static final int METHODID_GET_ALL_GAUGES = 0;
276   private static final int METHODID_GET_GAUGE = 1;
277 
278   private static final class MethodHandlers<Req, Resp> implements
279       io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
280       io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
281       io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
282       io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
283     private final MetricsServiceImplBase serviceImpl;
284     private final int methodId;
285 
MethodHandlers(MetricsServiceImplBase serviceImpl, int methodId)286     MethodHandlers(MetricsServiceImplBase serviceImpl, int methodId) {
287       this.serviceImpl = serviceImpl;
288       this.methodId = methodId;
289     }
290 
291     @java.lang.Override
292     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)293     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
294       switch (methodId) {
295         case METHODID_GET_ALL_GAUGES:
296           serviceImpl.getAllGauges((io.grpc.testing.integration.Metrics.EmptyMessage) request,
297               (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse>) responseObserver);
298           break;
299         case METHODID_GET_GAUGE:
300           serviceImpl.getGauge((io.grpc.testing.integration.Metrics.GaugeRequest) request,
301               (io.grpc.stub.StreamObserver<io.grpc.testing.integration.Metrics.GaugeResponse>) responseObserver);
302           break;
303         default:
304           throw new AssertionError();
305       }
306     }
307 
308     @java.lang.Override
309     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)310     public io.grpc.stub.StreamObserver<Req> invoke(
311         io.grpc.stub.StreamObserver<Resp> responseObserver) {
312       switch (methodId) {
313         default:
314           throw new AssertionError();
315       }
316     }
317   }
318 
319   private static abstract class MetricsServiceBaseDescriptorSupplier
320       implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
MetricsServiceBaseDescriptorSupplier()321     MetricsServiceBaseDescriptorSupplier() {}
322 
323     @java.lang.Override
getFileDescriptor()324     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
325       return io.grpc.testing.integration.Metrics.getDescriptor();
326     }
327 
328     @java.lang.Override
getServiceDescriptor()329     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
330       return getFileDescriptor().findServiceByName("MetricsService");
331     }
332   }
333 
334   private static final class MetricsServiceFileDescriptorSupplier
335       extends MetricsServiceBaseDescriptorSupplier {
MetricsServiceFileDescriptorSupplier()336     MetricsServiceFileDescriptorSupplier() {}
337   }
338 
339   private static final class MetricsServiceMethodDescriptorSupplier
340       extends MetricsServiceBaseDescriptorSupplier
341       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
342     private final String methodName;
343 
MetricsServiceMethodDescriptorSupplier(String methodName)344     MetricsServiceMethodDescriptorSupplier(String methodName) {
345       this.methodName = methodName;
346     }
347 
348     @java.lang.Override
getMethodDescriptor()349     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
350       return getServiceDescriptor().findMethodByName(methodName);
351     }
352   }
353 
354   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
355 
getServiceDescriptor()356   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
357     io.grpc.ServiceDescriptor result = serviceDescriptor;
358     if (result == null) {
359       synchronized (MetricsServiceGrpc.class) {
360         result = serviceDescriptor;
361         if (result == null) {
362           serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
363               .setSchemaDescriptor(new MetricsServiceFileDescriptorSupplier())
364               .addMethod(getGetAllGaugesMethod())
365               .addMethod(getGetGaugeMethod())
366               .build();
367         }
368       }
369     }
370     return result;
371   }
372 }
373