...

Source file src/google.golang.org/grpc/balancer/grpclb/grpc_lb_v1/load_balancer_grpc.pb.go

Documentation: google.golang.org/grpc/balancer/grpclb/grpc_lb_v1

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

View as plain text