1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
34
35
36 const _ = grpc.SupportPackageIsVersion8
37
38 const (
39 Health_Check_FullMethodName = "/grpc.health.v1.Health/Check"
40 Health_Watch_FullMethodName = "/grpc.health.v1.Health/Watch"
41 )
42
43
44
45
46 type HealthClient interface {
47
48
49
50
51
52
53
54
55
56 Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
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 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
85 out := new(HealthCheckResponse)
86 err := c.cc.Invoke(ctx, Health_Check_FullMethodName, in, out, cOpts...)
87 if err != nil {
88 return nil, err
89 }
90 return out, nil
91 }
92
93 func (c *healthClient) Watch(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (Health_WatchClient, error) {
94 cOpts := append([]grpc.CallOption{grpc.StaticMethod()}, opts...)
95 stream, err := c.cc.NewStream(ctx, &Health_ServiceDesc.Streams[0], Health_Watch_FullMethodName, cOpts...)
96 if err != nil {
97 return nil, err
98 }
99 x := &healthWatchClient{ClientStream: stream}
100 if err := x.ClientStream.SendMsg(in); err != nil {
101 return nil, err
102 }
103 if err := x.ClientStream.CloseSend(); err != nil {
104 return nil, err
105 }
106 return x, nil
107 }
108
109 type Health_WatchClient interface {
110 Recv() (*HealthCheckResponse, error)
111 grpc.ClientStream
112 }
113
114 type healthWatchClient struct {
115 grpc.ClientStream
116 }
117
118 func (x *healthWatchClient) Recv() (*HealthCheckResponse, error) {
119 m := new(HealthCheckResponse)
120 if err := x.ClientStream.RecvMsg(m); err != nil {
121 return nil, err
122 }
123 return m, nil
124 }
125
126
127
128
129 type HealthServer interface {
130
131
132
133
134
135
136
137
138
139 Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155 Watch(*HealthCheckRequest, Health_WatchServer) error
156 }
157
158
159 type UnimplementedHealthServer struct {
160 }
161
162 func (UnimplementedHealthServer) Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) {
163 return nil, status.Errorf(codes.Unimplemented, "method Check not implemented")
164 }
165 func (UnimplementedHealthServer) Watch(*HealthCheckRequest, Health_WatchServer) error {
166 return status.Errorf(codes.Unimplemented, "method Watch not implemented")
167 }
168
169
170
171
172 type UnsafeHealthServer interface {
173 mustEmbedUnimplementedHealthServer()
174 }
175
176 func RegisterHealthServer(s grpc.ServiceRegistrar, srv HealthServer) {
177 s.RegisterService(&Health_ServiceDesc, srv)
178 }
179
180 func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
181 in := new(HealthCheckRequest)
182 if err := dec(in); err != nil {
183 return nil, err
184 }
185 if interceptor == nil {
186 return srv.(HealthServer).Check(ctx, in)
187 }
188 info := &grpc.UnaryServerInfo{
189 Server: srv,
190 FullMethod: Health_Check_FullMethodName,
191 }
192 handler := func(ctx context.Context, req interface{}) (interface{}, error) {
193 return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest))
194 }
195 return interceptor(ctx, in, info, handler)
196 }
197
198 func _Health_Watch_Handler(srv interface{}, stream grpc.ServerStream) error {
199 m := new(HealthCheckRequest)
200 if err := stream.RecvMsg(m); err != nil {
201 return err
202 }
203 return srv.(HealthServer).Watch(m, &healthWatchServer{ServerStream: stream})
204 }
205
206 type Health_WatchServer interface {
207 Send(*HealthCheckResponse) error
208 grpc.ServerStream
209 }
210
211 type healthWatchServer struct {
212 grpc.ServerStream
213 }
214
215 func (x *healthWatchServer) Send(m *HealthCheckResponse) error {
216 return x.ServerStream.SendMsg(m)
217 }
218
219
220
221
222 var Health_ServiceDesc = grpc.ServiceDesc{
223 ServiceName: "grpc.health.v1.Health",
224 HandlerType: (*HealthServer)(nil),
225 Methods: []grpc.MethodDesc{
226 {
227 MethodName: "Check",
228 Handler: _Health_Check_Handler,
229 },
230 },
231 Streams: []grpc.StreamDesc{
232 {
233 StreamName: "Watch",
234 Handler: _Health_Watch_Handler,
235 ServerStreams: true,
236 },
237 },
238 Metadata: "grpc/health/v1/health.proto",
239 }
240
View as plain text