diff --git a/pkg/services/control/service.go b/pkg/services/control/service.go index 1ab9f6b85..f4ce62439 100644 --- a/pkg/services/control/service.go +++ b/pkg/services/control/service.go @@ -66,9 +66,17 @@ func (x *HealthCheckResponse_Body) SetNetmapStatus(v NetmapStatus) { } } +// SetHealthStatus sets health status of the storage node application. +func (x *HealthCheckResponse_Body) SetHealthStatus(v HealthStatus) { + if x != nil { + x.HealthStatus = v + } +} + const ( _ = iota healthRespBodyStatusFNum + healthRespBodyHealthStatusFNum ) // StableMarshal reads binary representation of health check response body @@ -89,7 +97,19 @@ func (x *HealthCheckResponse_Body) StableMarshal(buf []byte) ([]byte, error) { buf = make([]byte, sz) } - _, err := proto.EnumMarshal(healthRespBodyStatusFNum, buf, int32(x.NetmapStatus)) + var ( + offset, n int + err error + ) + + n, err = proto.EnumMarshal(healthRespBodyStatusFNum, buf[offset:], int32(x.NetmapStatus)) + if err != nil { + return nil, err + } + + offset += n + + _, err = proto.EnumMarshal(healthRespBodyHealthStatusFNum, buf[offset:], int32(x.HealthStatus)) if err != nil { return nil, err } @@ -109,6 +129,7 @@ func (x *HealthCheckResponse_Body) StableSize() int { size := 0 size += proto.EnumSize(healthRespBodyStatusFNum, int32(x.NetmapStatus)) + size += proto.EnumSize(healthRespBodyHealthStatusFNum, int32(x.HealthStatus)) return size } diff --git a/pkg/services/control/service.pb.go b/pkg/services/control/service.pb.go index fa6dae394..a253b3591 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 10652e257..50c23eeb3 100644 --- a/pkg/services/control/service.proto +++ b/pkg/services/control/service.proto @@ -34,6 +34,9 @@ message HealthCheckResponse { message Body { // Status of the storage node in NeoFS network map. NetmapStatus netmap_status = 1; + + // Health status of storage node application. + HealthStatus health_status = 2; } // Body of health check response message. diff --git a/pkg/services/control/service_test.go b/pkg/services/control/service_test.go index 8943a1bfb..3c9bb6012 100644 --- a/pkg/services/control/service_test.go +++ b/pkg/services/control/service_test.go @@ -22,12 +22,14 @@ func TestHealthCheckResponse_Body_StableMarshal(t *testing.T) { func generateHealthCheckResponseBody() *control.HealthCheckResponse_Body { body := new(control.HealthCheckResponse_Body) body.SetNetmapStatus(control.NetmapStatus_ONLINE) + body.SetHealthStatus(control.HealthStatus_SHUTTING_DOWN) return body } func equalHealthCheckResponseBodies(b1, b2 *control.HealthCheckResponse_Body) bool { - return b1.GetNetmapStatus() == b2.GetNetmapStatus() + return b1.GetNetmapStatus() == b2.GetNetmapStatus() && + b1.GetHealthStatus() == b2.GetHealthStatus() } func TestNetmapSnapshotResponse_Body_StableMarshal(t *testing.T) {