google.golang.org/grpc@v1.62.1/health/grpc_health_v1/health_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  // The canonical version of this proto can be found at
    16  // https://github.com/grpc/grpc-proto/blob/master/grpc/health/v1/health.proto
    17  
    18  // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
    19  // versions:
    20  // - protoc-gen-go-grpc v1.3.0
    21  // - protoc             v4.25.2
    22  // source: grpc/health/v1/health.proto
    23  
    24  package grpc_health_v1
    25  
    26  import (
    27  	context "context"
    28  	grpc "google.golang.org/grpc"
    29  	codes "google.golang.org/grpc/codes"
    30  	status "google.golang.org/grpc/status"
    31  )
    32  
    33  // This is a compile-time assertion to ensure that this generated file
    34  // is compatible with the grpc package it is being compiled against.
    35  // Requires gRPC-Go v1.32.0 or later.
    36  const _ = grpc.SupportPackageIsVersion7
    37  
    38  const (
    39  	Health_Check_FullMethodName = "/grpc.health.v1.Health/Check"
    40  	Health_Watch_FullMethodName = "/grpc.health.v1.Health/Watch"
    41  )
    42  
    43  // HealthClient is the client API for Health service.
    44  //
    45  // 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.
    46  type HealthClient interface {
    47  	// Check gets the health of the specified service. If the requested service
    48  	// is unknown, the call will fail with status NOT_FOUND. If the caller does
    49  	// not specify a service name, the server should respond with its overall
    50  	// health status.
    51  	//
    52  	// Clients should set a deadline when calling Check, and can declare the
    53  	// server unhealthy if they do not receive a timely response.
    54  	//
    55  	// Check implementations should be idempotent and side effect free.
    56  	Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
    57  	// Performs a watch for the serving status of the requested service.
    58  	// The server will immediately send back a message indicating the current
    59  	// serving status.  It will then subsequently send a new message whenever
    60  	// the service's serving status changes.
    61  	//
    62  	// If the requested service is unknown when the call is received, the
    63  	// server will send a message setting the serving status to
    64  	// SERVICE_UNKNOWN but will *not* terminate the call.  If at some
    65  	// future point, the serving status of the service becomes known, the
    66  	// server will send a new message with the service's serving status.
    67  	//
    68  	// If the call terminates with status UNIMPLEMENTED, then clients
    69  	// should assume this method is not supported and should not retry the
    70  	// call.  If the call terminates with any other status (including OK),
    71  	// clients should retry the call with appropriate exponential backoff.
    72  	Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error)
    73  }
    74  
    75  type healthClient struct {
    76  	cc grpc.ClientConnInterface
    77  }
    78  
    79  func NewHealthClient(cc grpc.ClientConnInterface) HealthClient {
    80  	return &healthClient{cc}
    81  }
    82  
    83  func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
    84  	out := new(HealthCheckResponse)
    85  	err := c.cc.Invoke(ctx, Health_Check_FullMethodName, in, out, opts...)
    86  	if err != nil {
    87  		return nil, err
    88  	}
    89  	return out, nil
    90  }
    91  
    92  func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) {
    93  	stream, err := c.cc.NewStream(ctx, &Health_ServiceDesc.Streams[0], Health_Watch_FullMethodName, opts...)
    94  	if err != nil {
    95  		return nil, err
    96  	}
    97  	x := &healthWatchClient{stream}
    98  	if err := x.ClientStream.SendMsg(in); err != nil {
    99  		return nil, err
   100  	}
   101  	if err := x.ClientStream.CloseSend(); err != nil {
   102  		return nil, err
   103  	}
   104  	return x, nil
   105  }
   106  
   107  type Health_WatchClient interface {
   108  	Recv() (*HealthCheckResponse, error)
   109  	grpc.ClientStream
   110  }
   111  
   112  type healthWatchClient struct {
   113  	grpc.ClientStream
   114  }
   115  
   116  func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) {
   117  	m := new(HealthCheckResponse)
   118  	if err := x.ClientStream.RecvMsg(m); err != nil {
   119  		return nil, err
   120  	}
   121  	return m, nil
   122  }
   123  
   124  // HealthServer is the server API for Health service.
   125  // All implementations should embed UnimplementedHealthServer
   126  // for forward compatibility
   127  type HealthServer interface {
   128  	// Check gets the health of the specified service. If the requested service
   129  	// is unknown, the call will fail with status NOT_FOUND. If the caller does
   130  	// not specify a service name, the server should respond with its overall
   131  	// health status.
   132  	//
   133  	// Clients should set a deadline when calling Check, and can declare the
   134  	// server unhealthy if they do not receive a timely response.
   135  	//
   136  	// Check implementations should be idempotent and side effect free.
   137  	Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
   138  	// Performs a watch for the serving status of the requested service.
   139  	// The server will immediately send back a message indicating the current
   140  	// serving status.  It will then subsequently send a new message whenever
   141  	// the service's serving status changes.
   142  	//
   143  	// If the requested service is unknown when the call is received, the
   144  	// server will send a message setting the serving status to
   145  	// SERVICE_UNKNOWN but will *not* terminate the call.  If at some
   146  	// future point, the serving status of the service becomes known, the
   147  	// server will send a new message with the service's serving status.
   148  	//
   149  	// If the call terminates with status UNIMPLEMENTED, then clients
   150  	// should assume this method is not supported and should not retry the
   151  	// call.  If the call terminates with any other status (including OK),
   152  	// clients should retry the call with appropriate exponential backoff.
   153  	Watch(*HealthCheckRequest, Health_WatchServer) error
   154  }
   155  
   156  // UnimplementedHealthServer should be embedded to have forward compatible implementations.
   157  type UnimplementedHealthServer struct {
   158  }
   159  
   160  func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
   161  	return nil, status.Errorf(codes.Unimplemented, "method Check not implemented")
   162  }
   163  func (UnimplementedHealthServer) Watch(*HealthCheckRequest, Health_WatchServer) error {
   164  	return status.Errorf(codes.Unimplemented, "method Watch not implemented")
   165  }
   166  
   167  // UnsafeHealthServer may be embedded to opt out of forward compatibility for this service.
   168  // Use of this interface is not recommended, as added methods to HealthServer will
   169  // result in compilation errors.
   170  type UnsafeHealthServer interface {
   171  	mustEmbedUnimplementedHealthServer()
   172  }
   173  
   174  func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer) {
   175  	s.RegisterService(&Health_ServiceDesc, srv)
   176  }
   177  
   178  func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
   179  	in := new(HealthCheckRequest)
   180  	if err := dec(in); err != nil {
   181  		return nil, err
   182  	}
   183  	if interceptor == nil {
   184  		return srv.(HealthServer).Check(ctx, in)
   185  	}
   186  	info := &grpc.UnaryServerInfo{
   187  		Server:     srv,
   188  		FullMethod: Health_Check_FullMethodName,
   189  	}
   190  	handler := func(ctx context.Context, req interface{}) (interface{}, error) {
   191  		return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest))
   192  	}
   193  	return interceptor(ctx, in, info, handler)
   194  }
   195  
   196  func _Health_Watch_Handler(srv interface{}, stream grpc.ServerStream) error {
   197  	m := new(HealthCheckRequest)
   198  	if err := stream.RecvMsg(m); err != nil {
   199  		return err
   200  	}
   201  	return srv.(HealthServer).Watch(m, &healthWatchServer{stream})
   202  }
   203  
   204  type Health_WatchServer interface {
   205  	Send(*HealthCheckResponse) error
   206  	grpc.ServerStream
   207  }
   208  
   209  type healthWatchServer struct {
   210  	grpc.ServerStream
   211  }
   212  
   213  func (x *healthWatchServer) Send(m *HealthCheckResponse) error {
   214  	return x.ServerStream.SendMsg(m)
   215  }
   216  
   217  // Health_ServiceDesc is the grpc.ServiceDesc for Health service.
   218  // It's only intended for direct use with grpc.RegisterService,
   219  // and not to be introspected or modified (even as a copy)
   220  var Health_ServiceDesc = grpc.ServiceDesc{
   221  	ServiceName: "grpc.health.v1.Health",
   222  	HandlerType: (*HealthServer)(nil),
   223  	Methods: []grpc.MethodDesc{
   224  		{
   225  			MethodName: "Check",
   226  			Handler:    _Health_Check_Handler,
   227  		},
   228  	},
   229  	Streams: []grpc.StreamDesc{
   230  		{
   231  			StreamName:    "Watch",
   232  			Handler:       _Health_Watch_Handler,
   233  			ServerStreams: true,
   234  		},
   235  	},
   236  	Metadata: "grpc/health/v1/health.proto",
   237  }