Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | package servers |
||
2 | |||
3 | import ( |
||
4 | "context" |
||
5 | |||
6 | "google.golang.org/grpc/codes" |
||
7 | health "google.golang.org/grpc/health/grpc_health_v1" |
||
8 | "google.golang.org/grpc/status" |
||
9 | ) |
||
10 | |||
11 | // HealthServer - Structure for Health Server |
||
12 | type HealthServer struct { |
||
13 | health.UnimplementedHealthServer |
||
14 | } |
||
15 | |||
16 | // NewHealthServer - Creates new HealthServer Server |
||
17 | func NewHealthServer() *HealthServer { |
||
18 | return &HealthServer{} |
||
19 | } |
||
20 | |||
21 | // Check - Return health check status response |
||
22 | func (s *HealthServer) Check(_ context.Context, _ *health.HealthCheckRequest) (*health.HealthCheckResponse, error) { |
||
23 | return &health.HealthCheckResponse{Status: health.HealthCheckResponse_SERVING}, nil |
||
24 | } |
||
25 | |||
26 | // Watch - TO:DO |
||
27 | func (s *HealthServer) Watch(_ *health.HealthCheckRequest, _ health.Health_WatchServer) error { |
||
28 | // Example of how to register both methods but only implement the Check method. |
||
29 | return status.Error(codes.Unimplemented, "unimplemented") |
||
30 | } |
||
31 | |||
32 | // AuthFuncOverride is called instead of authn. |
||
33 | func (s *HealthServer) AuthFuncOverride(ctx context.Context, fullMethodName string) (context.Context, error) { |
||
34 | return ctx, nil |
||
35 | } |
||
36 |