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