From f327024ee7c073050782c3ede517bb09e77bfd72 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Fri, 15 Jan 2021 13:22:44 +0300 Subject: [PATCH] [#312] control/server: Extended HealthChecker interface Add HealthStatus method to HealthChecker interface that should return current health status of the node application. Signed-off-by: Leonard Lyubich --- pkg/services/control/server/healthcheck.go | 1 + pkg/services/control/server/server.go | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/pkg/services/control/server/healthcheck.go b/pkg/services/control/server/healthcheck.go index 42e1f7e132..8155c68a8b 100644 --- a/pkg/services/control/server/healthcheck.go +++ b/pkg/services/control/server/healthcheck.go @@ -24,6 +24,7 @@ func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) resp.SetBody(body) body.SetNetmapStatus(s.healthChecker.NetmapStatus()) + body.SetHealthStatus(s.healthChecker.HealthStatus()) // sign the response if err := SignMessage(s.key, resp); err != nil { diff --git a/pkg/services/control/server/server.go b/pkg/services/control/server/server.go index eb3fea6224..5fdf2791b9 100644 --- a/pkg/services/control/server/server.go +++ b/pkg/services/control/server/server.go @@ -19,8 +19,14 @@ type HealthChecker interface { // Must calculate and return current status of the node in NeoFS network map. // // If status can not be calculated for any reason, - // control.HealthStatus_STATUS_UNDEFINED should be returned. + // control.netmapStatus_STATUS_UNDEFINED should be returned. NetmapStatus() control.NetmapStatus + + // Must calculate and return current health status of the node application. + // + // If status can not be calculated for any reason, + // control.HealthStatus_HEALTH_STATUS_UNDEFINED should be returned. + HealthStatus() control.HealthStatus } // Option of the Server's constructor.