From 567421a9b5874d2709c559c20edab87e300d05f6 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Wed, 9 Jun 2021 18:41:58 +0300 Subject: [PATCH] [#414] ir: Implement HealthChecker on Server `HealthChecker` interface is required to construct `ControlServiceServer`. Signed-off-by: Leonard Lyubich --- pkg/innerring/innerring.go | 1 + pkg/innerring/state.go | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/pkg/innerring/innerring.go b/pkg/innerring/innerring.go index d26a8e6e2..a1ad43764 100644 --- a/pkg/innerring/innerring.go +++ b/pkg/innerring/innerring.go @@ -60,6 +60,7 @@ type ( statusIndex *innerRingIndexer precision precision.Fixed8Converter auditClient *auditWrapper.ClientWrapper + healthStatus atomic.Value // notary configuration feeConfig *config.FeeConfig diff --git a/pkg/innerring/state.go b/pkg/innerring/state.go index 310f5e01d..abe90cb5b 100644 --- a/pkg/innerring/state.go +++ b/pkg/innerring/state.go @@ -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) +}