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