health_grpc.pb.go 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. // Code generated by protoc-gen-go-grpc. DO NOT EDIT.
  2. package grpc_health_v1
  3. import (
  4. context "context"
  5. grpc "google.golang.org/grpc"
  6. codes "google.golang.org/grpc/codes"
  7. status "google.golang.org/grpc/status"
  8. )
  9. // This is a compile-time assertion to ensure that this generated file
  10. // is compatible with the grpc package it is being compiled against.
  11. const _ = grpc.SupportPackageIsVersion6
  12. // HealthClient is the client API for Health service.
  13. //
  14. // 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.
  15. type HealthClient interface {
  16. // If the requested service is unknown, the call will fail with status
  17. // NOT_FOUND.
  18. Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
  19. // Performs a watch for the serving status of the requested service.
  20. // The server will immediately send back a message indicating the current
  21. // serving status. It will then subsequently send a new message whenever
  22. // the service's serving status changes.
  23. //
  24. // If the requested service is unknown when the call is received, the
  25. // server will send a message setting the serving status to
  26. // SERVICE_UNKNOWN but will *not* terminate the call. If at some
  27. // future point, the serving status of the service becomes known, the
  28. // server will send a new message with the service's serving status.
  29. //
  30. // If the call terminates with status UNIMPLEMENTED, then clients
  31. // should assume this method is not supported and should not retry the
  32. // call. If the call terminates with any other status (including OK),
  33. // clients should retry the call with appropriate exponential backoff.
  34. Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error)
  35. }
  36. type healthClient struct {
  37. cc grpc.ClientConnInterface
  38. }
  39. func NewHealthClient(cc grpc.ClientConnInterface) HealthClient {
  40. return &healthClient{cc}
  41. }
  42. func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) {
  43. out := new(HealthCheckResponse)
  44. err := c.cc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, opts...)
  45. if err != nil {
  46. return nil, err
  47. }
  48. return out, nil
  49. }
  50. func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) {
  51. stream, err := c.cc.NewStream(ctx, &_Health_serviceDesc.Streams[0], "/grpc.health.v1.Health/Watch", opts...)
  52. if err != nil {
  53. return nil, err
  54. }
  55. x := &healthWatchClient{stream}
  56. if err := x.ClientStream.SendMsg(in); err != nil {
  57. return nil, err
  58. }
  59. if err := x.ClientStream.CloseSend(); err != nil {
  60. return nil, err
  61. }
  62. return x, nil
  63. }
  64. type Health_WatchClient interface {
  65. Recv() (*HealthCheckResponse, error)
  66. grpc.ClientStream
  67. }
  68. type healthWatchClient struct {
  69. grpc.ClientStream
  70. }
  71. func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) {
  72. m := new(HealthCheckResponse)
  73. if err := x.ClientStream.RecvMsg(m); err != nil {
  74. return nil, err
  75. }
  76. return m, nil
  77. }
  78. // HealthServer is the server API for Health service.
  79. // All implementations should embed UnimplementedHealthServer
  80. // for forward compatibility
  81. type HealthServer interface {
  82. // If the requested service is unknown, the call will fail with status
  83. // NOT_FOUND.
  84. Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
  85. // Performs a watch for the serving status of the requested service.
  86. // The server will immediately send back a message indicating the current
  87. // serving status. It will then subsequently send a new message whenever
  88. // the service's serving status changes.
  89. //
  90. // If the requested service is unknown when the call is received, the
  91. // server will send a message setting the serving status to
  92. // SERVICE_UNKNOWN but will *not* terminate the call. If at some
  93. // future point, the serving status of the service becomes known, the
  94. // server will send a new message with the service's serving status.
  95. //
  96. // If the call terminates with status UNIMPLEMENTED, then clients
  97. // should assume this method is not supported and should not retry the
  98. // call. If the call terminates with any other status (including OK),
  99. // clients should retry the call with appropriate exponential backoff.
  100. Watch(*HealthCheckRequest, Health_WatchServer) error
  101. }
  102. // UnimplementedHealthServer should be embedded to have forward compatible implementations.
  103. type UnimplementedHealthServer struct {
  104. }
  105. func (*UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
  106. return nil, status.Errorf(codes.Unimplemented, "method Check not implemented")
  107. }
  108. func (*UnimplementedHealthServer) Watch(*HealthCheckRequest, Health_WatchServer) error {
  109. return status.Errorf(codes.Unimplemented, "method Watch not implemented")
  110. }
  111. func RegisterHealthServer(s *grpc.Server, srv HealthServer) {
  112. s.RegisterService(&_Health_serviceDesc, srv)
  113. }
  114. func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
  115. in := new(HealthCheckRequest)
  116. if err := dec(in); err != nil {
  117. return nil, err
  118. }
  119. if interceptor == nil {
  120. return srv.(HealthServer).Check(ctx, in)
  121. }
  122. info := &grpc.UnaryServerInfo{
  123. Server: srv,
  124. FullMethod: "/grpc.health.v1.Health/Check",
  125. }
  126. handler := func(ctx context.Context, req interface{}) (interface{}, error) {
  127. return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest))
  128. }
  129. return interceptor(ctx, in, info, handler)
  130. }
  131. func _Health_Watch_Handler(srv interface{}, stream grpc.ServerStream) error {
  132. m := new(HealthCheckRequest)
  133. if err := stream.RecvMsg(m); err != nil {
  134. return err
  135. }
  136. return srv.(HealthServer).Watch(m, &healthWatchServer{stream})
  137. }
  138. type Health_WatchServer interface {
  139. Send(*HealthCheckResponse) error
  140. grpc.ServerStream
  141. }
  142. type healthWatchServer struct {
  143. grpc.ServerStream
  144. }
  145. func (x *healthWatchServer) Send(m *HealthCheckResponse) error {
  146. return x.ServerStream.SendMsg(m)
  147. }
  148. var _Health_serviceDesc = grpc.ServiceDesc{
  149. ServiceName: "grpc.health.v1.Health",
  150. HandlerType: (*HealthServer)(nil),
  151. Methods: []grpc.MethodDesc{
  152. {
  153. MethodName: "Check",
  154. Handler: _Health_Check_Handler,
  155. },
  156. },
  157. Streams: []grpc.StreamDesc{
  158. {
  159. StreamName: "Watch",
  160. Handler: _Health_Watch_Handler,
  161. ServerStreams: true,
  162. },
  163. },
  164. Metadata: "grpc/health/v1/health.proto",
  165. }