google.golang.org/grpc@v1.72.2/balancer/grpclb/grpc_lb_v1/load_balancer_grpc.pb.go (about) 1 // Copyright 2015 The gRPC Authors 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 // Unless required by applicable law or agreed to in writing, software 10 // distributed under the License is distributed on an "AS IS" BASIS, 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 // This file defines the GRPCLB LoadBalancing protocol. 16 // 17 // The canonical version of this proto can be found at 18 // https://github.com/grpc/grpc-proto/blob/master/grpc/lb/v1/load_balancer.proto 19 20 // Code generated by protoc-gen-go-grpc. DO NOT EDIT. 21 // versions: 22 // - protoc-gen-go-grpc v1.5.1 23 // - protoc v5.27.1 24 // source: grpc/lb/v1/load_balancer.proto 25 26 package grpc_lb_v1 27 28 import ( 29 context "context" 30 grpc "google.golang.org/grpc" 31 codes "google.golang.org/grpc/codes" 32 status "google.golang.org/grpc/status" 33 ) 34 35 // This is a compile-time assertion to ensure that this generated file 36 // is compatible with the grpc package it is being compiled against. 37 // Requires gRPC-Go v1.64.0 or later. 38 const _ = grpc.SupportPackageIsVersion9 39 40 const ( 41 LoadBalancer_BalanceLoad_FullMethodName = "/grpc.lb.v1.LoadBalancer/BalanceLoad" 42 ) 43 44 // LoadBalancerClient is the client API for LoadBalancer service. 45 // 46 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream. 47 type LoadBalancerClient interface { 48 // Bidirectional rpc to get a list of servers. 49 BalanceLoad(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LoadBalanceRequest, LoadBalanceResponse], error) 50 } 51 52 type loadBalancerClient struct { 53 cc grpc.ClientConnInterface 54 } 55 56 func NewLoadBalancerClient(cc grpc.ClientConnInterface) LoadBalancerClient { 57 return &loadBalancerClient{cc} 58 } 59 60 func (c *loadBalancerClient) BalanceLoad(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[LoadBalanceRequest, LoadBalanceResponse], error) { 61 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...) 62 stream, err := c.cc.NewStream(ctx, &LoadBalancer_ServiceDesc.Streams[0], LoadBalancer_BalanceLoad_FullMethodName, cOpts...) 63 if err != nil { 64 return nil, err 65 } 66 x := &grpc.GenericClientStream[LoadBalanceRequest, LoadBalanceResponse]{ClientStream: stream} 67 return x, nil 68 } 69 70 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 71 type LoadBalancer_BalanceLoadClient = grpc.BidiStreamingClient[LoadBalanceRequest, LoadBalanceResponse] 72 73 // LoadBalancerServer is the server API for LoadBalancer service. 74 // All implementations should embed UnimplementedLoadBalancerServer 75 // for forward compatibility. 76 type LoadBalancerServer interface { 77 // Bidirectional rpc to get a list of servers. 78 BalanceLoad(grpc.BidiStreamingServer[LoadBalanceRequest, LoadBalanceResponse]) error 79 } 80 81 // UnimplementedLoadBalancerServer should be embedded to have 82 // forward compatible implementations. 83 // 84 // NOTE: this should be embedded by value instead of pointer to avoid a nil 85 // pointer dereference when methods are called. 86 type UnimplementedLoadBalancerServer struct{} 87 88 func (UnimplementedLoadBalancerServer) BalanceLoad(grpc.BidiStreamingServer[LoadBalanceRequest, LoadBalanceResponse]) error { 89 return status.Errorf(codes.Unimplemented, "method BalanceLoad not implemented") 90 } 91 func (UnimplementedLoadBalancerServer) testEmbeddedByValue() {} 92 93 // UnsafeLoadBalancerServer may be embedded to opt out of forward compatibility for this service. 94 // Use of this interface is not recommended, as added methods to LoadBalancerServer will 95 // result in compilation errors. 96 type UnsafeLoadBalancerServer interface { 97 mustEmbedUnimplementedLoadBalancerServer() 98 } 99 100 func RegisterLoadBalancerServer(s grpc.ServiceRegistrar, srv LoadBalancerServer) { 101 // If the following call panics, it indicates UnimplementedLoadBalancerServer was 102 // embedded by pointer and is nil. This will cause panics if an 103 // unimplemented method is ever invoked, so we test this at initialization 104 // time to prevent it from happening at runtime later due to I/O. 105 if t, ok := srv.(interface{ testEmbeddedByValue() }); ok { 106 t.testEmbeddedByValue() 107 } 108 s.RegisterService(&LoadBalancer_ServiceDesc, srv) 109 } 110 111 func _LoadBalancer_BalanceLoad_Handler(srv interface{}, stream grpc.ServerStream) error { 112 return srv.(LoadBalancerServer).BalanceLoad(&grpc.GenericServerStream[LoadBalanceRequest, LoadBalanceResponse]{ServerStream: stream}) 113 } 114 115 // This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name. 116 type LoadBalancer_BalanceLoadServer = grpc.BidiStreamingServer[LoadBalanceRequest, LoadBalanceResponse] 117 118 // LoadBalancer_ServiceDesc is the grpc.ServiceDesc for LoadBalancer service. 119 // It's only intended for direct use with grpc.RegisterService, 120 // and not to be introspected or modified (even as a copy) 121 var LoadBalancer_ServiceDesc = grpc.ServiceDesc{ 122 ServiceName: "grpc.lb.v1.LoadBalancer", 123 HandlerType: (*LoadBalancerServer)(nil), 124 Methods: []grpc.MethodDesc{}, 125 Streams: []grpc.StreamDesc{ 126 { 127 StreamName: "BalanceLoad", 128 Handler: _LoadBalancer_BalanceLoad_Handler, 129 ServerStreams: true, 130 ClientStreams: true, 131 }, 132 }, 133 Metadata: "grpc/lb/v1/load_balancer.proto", 134 }