diff --git a/cmd/neofs-cli/modules/control.go b/cmd/neofs-cli/modules/control.go index 4cf21e629..a2e47db5f 100644 --- a/cmd/neofs-cli/modules/control.go +++ b/cmd/neofs-cli/modules/control.go @@ -84,7 +84,7 @@ func healthCheck(cmd *cobra.Command, _ []string) error { return err } - cmd.Printf("Node status: %s\n", resp.GetBody().GetStatus()) + cmd.Printf("Node network status: %s\n", resp.GetBody().GetNetmapStatus()) return nil } diff --git a/cmd/neofs-node/config.go b/cmd/neofs-node/config.go index ec4660898..850a8b6fc 100644 --- a/cmd/neofs-node/config.go +++ b/cmd/neofs-node/config.go @@ -342,7 +342,7 @@ func initCfg(path string) *cfg { cfgObject: cfgObject{ pool: initObjectPool(viperCfg), }, - healthStatus: atomic.NewInt32(int32(control.HealthStatus_STATUS_UNDEFINED)), + healthStatus: atomic.NewInt32(int32(control.NetmapStatus_STATUS_UNDEFINED)), } initLocalStorage(c) diff --git a/cmd/neofs-node/control.go b/cmd/neofs-node/control.go index 47f69e81e..ed9572cc3 100644 --- a/cmd/neofs-node/control.go +++ b/cmd/neofs-node/control.go @@ -68,10 +68,10 @@ func initControlService(c *cfg) { })) } -func (c *cfg) setHealthStatus(st control.HealthStatus) { +func (c *cfg) setNetmapStatus(st control.NetmapStatus) { c.healthStatus.Store(int32(st)) } -func (c *cfg) HealthStatus() control.HealthStatus { - return control.HealthStatus(c.healthStatus.Load()) +func (c *cfg) NetmapStatus() control.NetmapStatus { + return control.NetmapStatus(c.healthStatus.Load()) } diff --git a/cmd/neofs-node/main.go b/cmd/neofs-node/main.go index e7aa5be8d..ff88dad97 100644 --- a/cmd/neofs-node/main.go +++ b/cmd/neofs-node/main.go @@ -56,7 +56,7 @@ func bootUp(c *cfg) { bootstrapNode(c) startWorkers(c) - c.setHealthStatus(control.HealthStatus_ONLINE) + c.setNetmapStatus(control.NetmapStatus_ONLINE) } func wait(c *cfg) { diff --git a/cmd/neofs-node/netmap.go b/cmd/neofs-node/netmap.go index ce03f9383..10007b5a7 100644 --- a/cmd/neofs-node/netmap.go +++ b/cmd/neofs-node/netmap.go @@ -117,7 +117,7 @@ func addNewEpochNotificationHandler(c *cfg, h event.Handler) { } func goOffline(c *cfg) { - c.setHealthStatus(control.HealthStatus_OFFLINE) + c.setNetmapStatus(control.NetmapStatus_OFFLINE) err := c.cfgNetmap.wrapper.UpdatePeerState( crypto.MarshalPublicKey(&c.key.PublicKey), diff --git a/pkg/services/control/server/healthcheck.go b/pkg/services/control/server/healthcheck.go index fbafbd0a7..42e1f7e13 100644 --- a/pkg/services/control/server/healthcheck.go +++ b/pkg/services/control/server/healthcheck.go @@ -23,7 +23,7 @@ func (s *Server) HealthCheck(_ context.Context, req *control.HealthCheckRequest) body := new(control.HealthCheckResponse_Body) resp.SetBody(body) - body.SetStatus(s.healthChecker.HealthStatus()) + body.SetNetmapStatus(s.healthChecker.NetmapStatus()) // sign the response if err := SignMessage(s.key, resp); err != nil { diff --git a/pkg/services/control/server/netmap_snapshot.go b/pkg/services/control/server/netmap_snapshot.go index c790f8208..d7252b330 100644 --- a/pkg/services/control/server/netmap_snapshot.go +++ b/pkg/services/control/server/netmap_snapshot.go @@ -63,14 +63,14 @@ func nodesFromAPI(apiNodes netmapAPI.Nodes) []*control.NodeInfo { return nodes } -func stateFromAPI(s netmapAPI.NodeState) control.HealthStatus { +func stateFromAPI(s netmapAPI.NodeState) control.NetmapStatus { switch s { default: - return control.HealthStatus_STATUS_UNDEFINED + return control.NetmapStatus_STATUS_UNDEFINED case netmapAPI.NodeStateOffline: - return control.HealthStatus_OFFLINE + return control.NetmapStatus_OFFLINE case netmapAPI.NodeStateOnline: - return control.HealthStatus_ONLINE + return control.NetmapStatus_ONLINE } } diff --git a/pkg/services/control/server/server.go b/pkg/services/control/server/server.go index 6f88ffac1..eb3fea622 100644 --- a/pkg/services/control/server/server.go +++ b/pkg/services/control/server/server.go @@ -16,11 +16,11 @@ type Server struct { // HealthChecker is component interface for calculating // the current health status of a node. type HealthChecker interface { - // Must calculate and return current node health status. + // 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. - HealthStatus() control.HealthStatus + NetmapStatus() control.NetmapStatus } // Option of the Server's constructor. diff --git a/pkg/services/control/service.go b/pkg/services/control/service.go index 237a8987d..1ab9f6b85 100644 --- a/pkg/services/control/service.go +++ b/pkg/services/control/service.go @@ -59,10 +59,10 @@ func (x *HealthCheckRequest) SignedDataSize() int { return x.GetBody().StableSize() } -// SetStatus sets health status of storage node. -func (x *HealthCheckResponse_Body) SetStatus(v HealthStatus) { +// SetNetmapStatus sets status of the storage node in NeoFS network map. +func (x *HealthCheckResponse_Body) SetNetmapStatus(v NetmapStatus) { if x != nil { - x.Status = v + x.NetmapStatus = v } } @@ -89,7 +89,7 @@ func (x *HealthCheckResponse_Body) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, sz) } - _, err := proto.EnumMarshal(healthRespBodyStatusFNum, buf, int32(x.Status)) + _, err := proto.EnumMarshal(healthRespBodyStatusFNum, buf, int32(x.NetmapStatus)) if err != nil { return nil, err } @@ -108,7 +108,7 @@ func (x *HealthCheckResponse_Body) StableSize() int { size := 0 - size += proto.EnumSize(healthRespBodyStatusFNum, int32(x.Status)) + size += proto.EnumSize(healthRespBodyStatusFNum, int32(x.NetmapStatus)) return size } diff --git a/pkg/services/control/service.pb.go b/pkg/services/control/service.pb.go index c571ed0cf..598ea9f9d 100644 Binary files a/pkg/services/control/service.pb.go and b/pkg/services/control/service.pb.go differ diff --git a/pkg/services/control/service.proto b/pkg/services/control/service.proto index 1cfdc6d2f..10652e257 100644 --- a/pkg/services/control/service.proto +++ b/pkg/services/control/service.proto @@ -32,8 +32,8 @@ message HealthCheckRequest { message HealthCheckResponse { // Health check response body message Body { - // Health status of storage node. - HealthStatus status = 1; + // Status of the storage node in NeoFS network map. + NetmapStatus netmap_status = 1; } // Body of health check response message. diff --git a/pkg/services/control/service_test.go b/pkg/services/control/service_test.go index 78732b2e7..8943a1bfb 100644 --- a/pkg/services/control/service_test.go +++ b/pkg/services/control/service_test.go @@ -21,13 +21,13 @@ func TestHealthCheckResponse_Body_StableMarshal(t *testing.T) { func generateHealthCheckResponseBody() *control.HealthCheckResponse_Body { body := new(control.HealthCheckResponse_Body) - body.SetStatus(control.HealthStatus_ONLINE) + body.SetNetmapStatus(control.NetmapStatus_ONLINE) return body } func equalHealthCheckResponseBodies(b1, b2 *control.HealthCheckResponse_Body) bool { - return b1.GetStatus() == b2.GetStatus() + return b1.GetNetmapStatus() == b2.GetNetmapStatus() } func TestNetmapSnapshotResponse_Body_StableMarshal(t *testing.T) { diff --git a/pkg/services/control/types.go b/pkg/services/control/types.go index d6cb909f6..d19275fef 100644 --- a/pkg/services/control/types.go +++ b/pkg/services/control/types.go @@ -140,7 +140,7 @@ func (x *NodeInfo) SetAttributes(v []*NodeInfo_Attribute) { } // SetState sets state of the NeoFS node. -func (x *NodeInfo) SetState(v HealthStatus) { +func (x *NodeInfo) SetState(v NetmapStatus) { if x != nil { x.State = v } diff --git a/pkg/services/control/types.pb.go b/pkg/services/control/types.pb.go index ca731c48b..c6aab8786 100644 Binary files a/pkg/services/control/types.pb.go and b/pkg/services/control/types.pb.go differ diff --git a/pkg/services/control/types.proto b/pkg/services/control/types.proto index f481e04ee..03b5a128f 100644 --- a/pkg/services/control/types.proto +++ b/pkg/services/control/types.proto @@ -13,8 +13,8 @@ message Signature { bytes sign = 2 [json_name = "signature"]; } -// Health status of the storage node. -enum HealthStatus { +// Status of the storage node in the NeoFS network map. +enum NetmapStatus { // Undefined status, default value. STATUS_UNDEFINED = 0; @@ -90,7 +90,7 @@ message NodeInfo { repeated Attribute attributes = 3 [json_name = "attributes"]; // Carries state of the NeoFS node. - HealthStatus state = 4 [json_name = "state"]; + NetmapStatus state = 4 [json_name = "state"]; } // Network map structure. diff --git a/pkg/services/control/types_test.go b/pkg/services/control/types_test.go index aa7237e3b..faed9ba77 100644 --- a/pkg/services/control/types_test.go +++ b/pkg/services/control/types_test.go @@ -25,7 +25,7 @@ func generateNetmap() *control.Netmap { n := new(control.NodeInfo) n.SetPublicKey(testData(33)) n.SetAddress(testString()) - n.SetState(control.HealthStatus_ONLINE) + n.SetState(control.NetmapStatus_ONLINE) const attrCount = 2