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