1 package io.grpc.lb.v1;
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/lb/v1/load_balancer.proto")
23 public final class LoadBalancerGrpc {
24 
LoadBalancerGrpc()25   private LoadBalancerGrpc() {}
26 
27   public static final String SERVICE_NAME = "grpc.lb.v1.LoadBalancer";
28 
29   // Static method descriptors that strictly reflect the proto.
30   private static volatile io.grpc.MethodDescriptor<io.grpc.lb.v1.LoadBalanceRequest,
31       io.grpc.lb.v1.LoadBalanceResponse> getBalanceLoadMethod;
32 
33   @io.grpc.stub.annotations.RpcMethod(
34       fullMethodName = SERVICE_NAME + '/' + "BalanceLoad",
35       requestType = io.grpc.lb.v1.LoadBalanceRequest.class,
36       responseType = io.grpc.lb.v1.LoadBalanceResponse.class,
37       methodType = io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
38   public static io.grpc.MethodDescriptor<io.grpc.lb.v1.LoadBalanceRequest,
getBalanceLoadMethod()39       io.grpc.lb.v1.LoadBalanceResponse> getBalanceLoadMethod() {
40     io.grpc.MethodDescriptor<io.grpc.lb.v1.LoadBalanceRequest, io.grpc.lb.v1.LoadBalanceResponse> getBalanceLoadMethod;
41     if ((getBalanceLoadMethod = LoadBalancerGrpc.getBalanceLoadMethod) == null) {
42       synchronized (LoadBalancerGrpc.class) {
43         if ((getBalanceLoadMethod = LoadBalancerGrpc.getBalanceLoadMethod) == null) {
44           LoadBalancerGrpc.getBalanceLoadMethod = getBalanceLoadMethod =
45               io.grpc.MethodDescriptor.<io.grpc.lb.v1.LoadBalanceRequest, io.grpc.lb.v1.LoadBalanceResponse>newBuilder()
46               .setType(io.grpc.MethodDescriptor.MethodType.BIDI_STREAMING)
47               .setFullMethodName(generateFullMethodName(
48                   "grpc.lb.v1.LoadBalancer", "BalanceLoad"))
49               .setSampledToLocalTracing(true)
50               .setRequestMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
51                   io.grpc.lb.v1.LoadBalanceRequest.getDefaultInstance()))
52               .setResponseMarshaller(io.grpc.protobuf.ProtoUtils.marshaller(
53                   io.grpc.lb.v1.LoadBalanceResponse.getDefaultInstance()))
54                   .setSchemaDescriptor(new LoadBalancerMethodDescriptorSupplier("BalanceLoad"))
55                   .build();
56           }
57         }
58      }
59      return getBalanceLoadMethod;
60   }
61 
62   /**
63    * Creates a new async stub that supports all call types for the service
64    */
newStub(io.grpc.Channel channel)65   public static LoadBalancerStub newStub(io.grpc.Channel channel) {
66     return new LoadBalancerStub(channel);
67   }
68 
69   /**
70    * Creates a new blocking-style stub that supports unary and streaming output calls on the service
71    */
newBlockingStub( io.grpc.Channel channel)72   public static LoadBalancerBlockingStub newBlockingStub(
73       io.grpc.Channel channel) {
74     return new LoadBalancerBlockingStub(channel);
75   }
76 
77   /**
78    * Creates a new ListenableFuture-style stub that supports unary calls on the service
79    */
newFutureStub( io.grpc.Channel channel)80   public static LoadBalancerFutureStub newFutureStub(
81       io.grpc.Channel channel) {
82     return new LoadBalancerFutureStub(channel);
83   }
84 
85   /**
86    */
87   public static abstract class LoadBalancerImplBase implements io.grpc.BindableService {
88 
89     /**
90      * <pre>
91      * Bidirectional rpc to get a list of servers.
92      * </pre>
93      */
balanceLoad( io.grpc.stub.StreamObserver<io.grpc.lb.v1.LoadBalanceResponse> responseObserver)94     public io.grpc.stub.StreamObserver<io.grpc.lb.v1.LoadBalanceRequest> balanceLoad(
95         io.grpc.stub.StreamObserver<io.grpc.lb.v1.LoadBalanceResponse> responseObserver) {
96       return asyncUnimplementedStreamingCall(getBalanceLoadMethod(), responseObserver);
97     }
98 
bindService()99     @java.lang.Override public final io.grpc.ServerServiceDefinition bindService() {
100       return io.grpc.ServerServiceDefinition.builder(getServiceDescriptor())
101           .addMethod(
102             getBalanceLoadMethod(),
103             asyncBidiStreamingCall(
104               new MethodHandlers<
105                 io.grpc.lb.v1.LoadBalanceRequest,
106                 io.grpc.lb.v1.LoadBalanceResponse>(
107                   this, METHODID_BALANCE_LOAD)))
108           .build();
109     }
110   }
111 
112   /**
113    */
114   public static final class LoadBalancerStub extends io.grpc.stub.AbstractStub<LoadBalancerStub> {
LoadBalancerStub(io.grpc.Channel channel)115     private LoadBalancerStub(io.grpc.Channel channel) {
116       super(channel);
117     }
118 
LoadBalancerStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)119     private LoadBalancerStub(io.grpc.Channel channel,
120         io.grpc.CallOptions callOptions) {
121       super(channel, callOptions);
122     }
123 
124     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)125     protected LoadBalancerStub build(io.grpc.Channel channel,
126         io.grpc.CallOptions callOptions) {
127       return new LoadBalancerStub(channel, callOptions);
128     }
129 
130     /**
131      * <pre>
132      * Bidirectional rpc to get a list of servers.
133      * </pre>
134      */
balanceLoad( io.grpc.stub.StreamObserver<io.grpc.lb.v1.LoadBalanceResponse> responseObserver)135     public io.grpc.stub.StreamObserver<io.grpc.lb.v1.LoadBalanceRequest> balanceLoad(
136         io.grpc.stub.StreamObserver<io.grpc.lb.v1.LoadBalanceResponse> responseObserver) {
137       return asyncBidiStreamingCall(
138           getChannel().newCall(getBalanceLoadMethod(), getCallOptions()), responseObserver);
139     }
140   }
141 
142   /**
143    */
144   public static final class LoadBalancerBlockingStub extends io.grpc.stub.AbstractStub<LoadBalancerBlockingStub> {
LoadBalancerBlockingStub(io.grpc.Channel channel)145     private LoadBalancerBlockingStub(io.grpc.Channel channel) {
146       super(channel);
147     }
148 
LoadBalancerBlockingStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)149     private LoadBalancerBlockingStub(io.grpc.Channel channel,
150         io.grpc.CallOptions callOptions) {
151       super(channel, callOptions);
152     }
153 
154     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)155     protected LoadBalancerBlockingStub build(io.grpc.Channel channel,
156         io.grpc.CallOptions callOptions) {
157       return new LoadBalancerBlockingStub(channel, callOptions);
158     }
159   }
160 
161   /**
162    */
163   public static final class LoadBalancerFutureStub extends io.grpc.stub.AbstractStub<LoadBalancerFutureStub> {
LoadBalancerFutureStub(io.grpc.Channel channel)164     private LoadBalancerFutureStub(io.grpc.Channel channel) {
165       super(channel);
166     }
167 
LoadBalancerFutureStub(io.grpc.Channel channel, io.grpc.CallOptions callOptions)168     private LoadBalancerFutureStub(io.grpc.Channel channel,
169         io.grpc.CallOptions callOptions) {
170       super(channel, callOptions);
171     }
172 
173     @java.lang.Override
build(io.grpc.Channel channel, io.grpc.CallOptions callOptions)174     protected LoadBalancerFutureStub build(io.grpc.Channel channel,
175         io.grpc.CallOptions callOptions) {
176       return new LoadBalancerFutureStub(channel, callOptions);
177     }
178   }
179 
180   private static final int METHODID_BALANCE_LOAD = 0;
181 
182   private static final class MethodHandlers<Req, Resp> implements
183       io.grpc.stub.ServerCalls.UnaryMethod<Req, Resp>,
184       io.grpc.stub.ServerCalls.ServerStreamingMethod<Req, Resp>,
185       io.grpc.stub.ServerCalls.ClientStreamingMethod<Req, Resp>,
186       io.grpc.stub.ServerCalls.BidiStreamingMethod<Req, Resp> {
187     private final LoadBalancerImplBase serviceImpl;
188     private final int methodId;
189 
MethodHandlers(LoadBalancerImplBase serviceImpl, int methodId)190     MethodHandlers(LoadBalancerImplBase serviceImpl, int methodId) {
191       this.serviceImpl = serviceImpl;
192       this.methodId = methodId;
193     }
194 
195     @java.lang.Override
196     @java.lang.SuppressWarnings("unchecked")
invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver)197     public void invoke(Req request, io.grpc.stub.StreamObserver<Resp> responseObserver) {
198       switch (methodId) {
199         default:
200           throw new AssertionError();
201       }
202     }
203 
204     @java.lang.Override
205     @java.lang.SuppressWarnings("unchecked")
invoke( io.grpc.stub.StreamObserver<Resp> responseObserver)206     public io.grpc.stub.StreamObserver<Req> invoke(
207         io.grpc.stub.StreamObserver<Resp> responseObserver) {
208       switch (methodId) {
209         case METHODID_BALANCE_LOAD:
210           return (io.grpc.stub.StreamObserver<Req>) serviceImpl.balanceLoad(
211               (io.grpc.stub.StreamObserver<io.grpc.lb.v1.LoadBalanceResponse>) responseObserver);
212         default:
213           throw new AssertionError();
214       }
215     }
216   }
217 
218   private static abstract class LoadBalancerBaseDescriptorSupplier
219       implements io.grpc.protobuf.ProtoFileDescriptorSupplier, io.grpc.protobuf.ProtoServiceDescriptorSupplier {
LoadBalancerBaseDescriptorSupplier()220     LoadBalancerBaseDescriptorSupplier() {}
221 
222     @java.lang.Override
getFileDescriptor()223     public com.google.protobuf.Descriptors.FileDescriptor getFileDescriptor() {
224       return io.grpc.lb.v1.LoadBalancerProto.getDescriptor();
225     }
226 
227     @java.lang.Override
getServiceDescriptor()228     public com.google.protobuf.Descriptors.ServiceDescriptor getServiceDescriptor() {
229       return getFileDescriptor().findServiceByName("LoadBalancer");
230     }
231   }
232 
233   private static final class LoadBalancerFileDescriptorSupplier
234       extends LoadBalancerBaseDescriptorSupplier {
LoadBalancerFileDescriptorSupplier()235     LoadBalancerFileDescriptorSupplier() {}
236   }
237 
238   private static final class LoadBalancerMethodDescriptorSupplier
239       extends LoadBalancerBaseDescriptorSupplier
240       implements io.grpc.protobuf.ProtoMethodDescriptorSupplier {
241     private final String methodName;
242 
LoadBalancerMethodDescriptorSupplier(String methodName)243     LoadBalancerMethodDescriptorSupplier(String methodName) {
244       this.methodName = methodName;
245     }
246 
247     @java.lang.Override
getMethodDescriptor()248     public com.google.protobuf.Descriptors.MethodDescriptor getMethodDescriptor() {
249       return getServiceDescriptor().findMethodByName(methodName);
250     }
251   }
252 
253   private static volatile io.grpc.ServiceDescriptor serviceDescriptor;
254 
getServiceDescriptor()255   public static io.grpc.ServiceDescriptor getServiceDescriptor() {
256     io.grpc.ServiceDescriptor result = serviceDescriptor;
257     if (result == null) {
258       synchronized (LoadBalancerGrpc.class) {
259         result = serviceDescriptor;
260         if (result == null) {
261           serviceDescriptor = result = io.grpc.ServiceDescriptor.newBuilder(SERVICE_NAME)
262               .setSchemaDescriptor(new LoadBalancerFileDescriptorSupplier())
263               .addMethod(getBalanceLoadMethod())
264               .build();
265         }
266       }
267     }
268     return result;
269   }
270 }
271