[#414] ir: Implement HealthChecker on Server

`HealthChecker` interface is required to construct `ControlServiceServer`.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-06-09 18:41:58 +03:00 committed by Alex Vanin
parent dcfe9a6504
commit 567421a9b5
2 changed files with 11 additions and 0 deletions

View file

@ -60,6 +60,7 @@ type (
statusIndex *innerRingIndexer
precision precision.Fixed8Converter
auditClient *auditWrapper.ClientWrapper
healthStatus atomic.Value
// notary configuration
feeConfig *config.FeeConfig

View file

@ -6,6 +6,7 @@ import (
"github.com/nspcc-dev/neo-go/pkg/crypto/keys"
"github.com/nspcc-dev/neo-go/pkg/util"
"github.com/nspcc-dev/neofs-node/pkg/services/audit"
control "github.com/nspcc-dev/neofs-node/pkg/services/control/ir"
"go.uber.org/zap"
)
@ -130,3 +131,12 @@ func (s *Server) WriteReport(r *audit.Report) error {
func (s *Server) ResetEpochTimer() error {
return s.epochTimer.Reset()
}
func (s *Server) setHealthStatus(hs control.HealthStatus) {
s.healthStatus.Store(hs)
}
// HealthStatus returns current health status of IR application.
func (s *Server) HealthStatus() control.HealthStatus {
return s.healthStatus.Load().(control.HealthStatus)
}