[#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 <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-15 13:22:44 +03:00 committed by Alex Vanin
parent 6ae51e41f9
commit f327024ee7
2 changed files with 8 additions and 1 deletions

View file

@ -24,6 +24,7 @@ func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest)
resp.SetBody(body) resp.SetBody(body)
body.SetNetmapStatus(s.healthChecker.NetmapStatus()) body.SetNetmapStatus(s.healthChecker.NetmapStatus())
body.SetHealthStatus(s.healthChecker.HealthStatus())
// sign the response // sign the response
if err := SignMessage(s.key, resp); err != nil { if err := SignMessage(s.key, resp); err != nil {

View file

@ -19,8 +19,14 @@ type HealthChecker interface {
// Must calculate and return current status of the node in NeoFS network map. // Must calculate and return current status of the node in NeoFS network map.
// //
// If status can not be calculated for any reason, // 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 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. // Option of the Server's constructor.