google.golang.org/grpc@v1.62.1/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.3.0 23 // - protoc v4.25.2 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.32.0 or later. 38 const _ = grpc.SupportPackageIsVersion7 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) (LoadBalancer_BalanceLoadClient, 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) (LoadBalancer_BalanceLoadClient, error) { 61 stream, err := c.cc.NewStream(ctx, &LoadBalancer_ServiceDesc.Streams[0], LoadBalancer_BalanceLoad_FullMethodName, opts...) 62 if err != nil { 63 return nil, err 64 } 65 x := &loadBalancerBalanceLoadClient{stream} 66 return x, nil 67 } 68 69 type LoadBalancer_BalanceLoadClient interface { 70 Send(*LoadBalanceRequest) error 71 Recv() (*LoadBalanceResponse, error) 72 grpc.ClientStream 73 } 74 75 type loadBalancerBalanceLoadClient struct { 76 grpc.ClientStream 77 } 78 79 func (x *loadBalancerBalanceLoadClient) Send(m *LoadBalanceRequest) error { 80 return x.ClientStream.SendMsg(m) 81 } 82 83 func (x *loadBalancerBalanceLoadClient) Recv() (*LoadBalanceResponse, error) { 84 m := new(LoadBalanceResponse) 85 if err := x.ClientStream.RecvMsg(m); err != nil { 86 return nil, err 87 } 88 return m, nil 89 } 90 91 // LoadBalancerServer is the server API for LoadBalancer service. 92 // All implementations should embed UnimplementedLoadBalancerServer 93 // for forward compatibility 94 type LoadBalancerServer interface { 95 // Bidirectional rpc to get a list of servers. 96 BalanceLoad(LoadBalancer_BalanceLoadServer) error 97 } 98 99 // UnimplementedLoadBalancerServer should be embedded to have forward compatible implementations. 100 type UnimplementedLoadBalancerServer struct { 101 } 102 103 func (UnimplementedLoadBalancerServer) BalanceLoad(LoadBalancer_BalanceLoadServer) error { 104 return status.Errorf(codes.Unimplemented, "method BalanceLoad not implemented") 105 } 106 107 // UnsafeLoadBalancerServer may be embedded to opt out of forward compatibility for this service. 108 // Use of this interface is not recommended, as added methods to LoadBalancerServer will 109 // result in compilation errors. 110 type UnsafeLoadBalancerServer interface { 111 mustEmbedUnimplementedLoadBalancerServer() 112 } 113 114 func RegisterLoadBalancerServer(s grpc.ServiceRegistrar, srv LoadBalancerServer) { 115 s.RegisterService(&LoadBalancer_ServiceDesc, srv) 116 } 117 118 func _LoadBalancer_BalanceLoad_Handler(srv interface{}, stream grpc.ServerStream) error { 119 return srv.(LoadBalancerServer).BalanceLoad(&loadBalancerBalanceLoadServer{stream}) 120 } 121 122 type LoadBalancer_BalanceLoadServer interface { 123 Send(*LoadBalanceResponse) error 124 Recv() (*LoadBalanceRequest, error) 125 grpc.ServerStream 126 } 127 128 type loadBalancerBalanceLoadServer struct { 129 grpc.ServerStream 130 } 131 132 func (x *loadBalancerBalanceLoadServer) Send(m *LoadBalanceResponse) error { 133 return x.ServerStream.SendMsg(m) 134 } 135 136 func (x *loadBalancerBalanceLoadServer) Recv() (*LoadBalanceRequest, error) { 137 m := new(LoadBalanceRequest) 138 if err := x.ServerStream.RecvMsg(m); err != nil { 139 return nil, err 140 } 141 return m, nil 142 } 143 144 // LoadBalancer_ServiceDesc is the grpc.ServiceDesc for LoadBalancer service. 145 // It's only intended for direct use with grpc.RegisterService, 146 // and not to be introspected or modified (even as a copy) 147 var LoadBalancer_ServiceDesc = grpc.ServiceDesc{ 148 ServiceName: "grpc.lb.v1.LoadBalancer", 149 HandlerType: (*LoadBalancerServer)(nil), 150 Methods: []grpc.MethodDesc{}, 151 Streams: []grpc.StreamDesc{ 152 { 153 StreamName: "BalanceLoad", 154 Handler: _LoadBalancer_BalanceLoad_Handler, 155 ServerStreams: true, 156 ClientStreams: true, 157 }, 158 }, 159 Metadata: "grpc/lb/v1/load_balancer.proto", 160 }