forked from TrueCloudLab/frostfs-node
[#313] control: Rename HealthStatus enum to NetmapStatus
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
a89567a88d
commit
83d4420a30
16 changed files with 98 additions and 98 deletions
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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())
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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),
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
92
pkg/services/control/service.pb.go
generated
92
pkg/services/control/service.pb.go
generated
|
@ -306,8 +306,8 @@ type HealthCheckResponse_Body struct {
|
|||
sizeCache protoimpl.SizeCache
|
||||
unknownFields protoimpl.UnknownFields
|
||||
|
||||
// Health status of storage node.
|
||||
Status HealthStatus `protobuf:"varint,1,opt,name=status,proto3,enum=control.HealthStatus" json:"status,omitempty"`
|
||||
// Network map status of storage node.
|
||||
NetmapStatus NetmapStatus `protobuf:"varint,1,opt,name=netmap_status,json=netmapStatus,proto3,enum=control.NetmapStatus" json:"netmap_status,omitempty"`
|
||||
}
|
||||
|
||||
func (x *HealthCheckResponse_Body) Reset() {
|
||||
|
@ -342,11 +342,11 @@ func (*HealthCheckResponse_Body) Descriptor() ([]byte, []int) {
|
|||
return file_pkg_services_control_service_proto_rawDescGZIP(), []int{1, 0}
|
||||
}
|
||||
|
||||
func (x *HealthCheckResponse_Body) GetStatus() HealthStatus {
|
||||
func (x *HealthCheckResponse_Body) GetNetmapStatus() NetmapStatus {
|
||||
if x != nil {
|
||||
return x.Status
|
||||
return x.NetmapStatus
|
||||
}
|
||||
return HealthStatus_STATUS_UNDEFINED
|
||||
return NetmapStatus_STATUS_UNDEFINED
|
||||
}
|
||||
|
||||
// Get netmap snapshot request body.
|
||||
|
@ -453,7 +453,7 @@ var file_pkg_services_control_service_proto_rawDesc = []byte{
|
|||
0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32,
|
||||
0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74,
|
||||
0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x06,
|
||||
0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xb5, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74,
|
||||
0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xc2, 0x01, 0x0a, 0x13, 0x48, 0x65, 0x61, 0x6c, 0x74,
|
||||
0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x35,
|
||||
0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x21, 0x2e, 0x63,
|
||||
0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65,
|
||||
|
@ -461,46 +461,46 @@ var file_pkg_services_control_service_proto_rawDesc = []byte{
|
|||
0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75,
|
||||
0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72,
|
||||
0x6f, 0x6c, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69,
|
||||
0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x35, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12,
|
||||
0x2d, 0x0a, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32,
|
||||
0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68,
|
||||
0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x06, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x8a,
|
||||
0x01, 0x0a, 0x15, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f,
|
||||
0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
|
||||
0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52,
|
||||
0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64,
|
||||
0x79, 0x12, 0x30, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53,
|
||||
0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
|
||||
0x75, 0x72, 0x65, 0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xb5, 0x01, 0x0a, 0x16,
|
||||
0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a, 0x42, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12,
|
||||
0x3a, 0x0a, 0x0d, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x5f, 0x73, 0x74, 0x61, 0x74, 0x75, 0x73,
|
||||
0x18, 0x01, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c,
|
||||
0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x0c, 0x6e,
|
||||
0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x22, 0x8a, 0x01, 0x0a, 0x15,
|
||||
0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65,
|
||||
0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01,
|
||||
0x20, 0x01, 0x28, 0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e,
|
||||
0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73,
|
||||
0x70, 0x6f, 0x6e, 0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79,
|
||||
0x12, 0x30, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x69,
|
||||
0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75,
|
||||
0x72, 0x65, 0x1a, 0x2f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x27, 0x0a, 0x06, 0x6e, 0x65,
|
||||
0x74, 0x6d, 0x61, 0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6e,
|
||||
0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x52, 0x06, 0x6e, 0x65, 0x74,
|
||||
0x6d, 0x61, 0x70, 0x32, 0xad, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53,
|
||||
0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68,
|
||||
0x43, 0x68, 0x65, 0x63, 0x6b, 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e,
|
||||
0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1c, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61,
|
||||
0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x12, 0x51, 0x0a, 0x0e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68,
|
||||
0x6f, 0x74, 0x12, 0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x65, 0x74,
|
||||
0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65,
|
||||
0x73, 0x74, 0x1a, 0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x65, 0x74,
|
||||
0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x37, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20,
|
||||
0x01, 0x28, 0x0b, 0x32, 0x23, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x65,
|
||||
0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75,
|
||||
0x65, 0x73, 0x74, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x30,
|
||||
0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x69, 0x67, 0x6e,
|
||||
0x61, 0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65,
|
||||
0x1a, 0x06, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x22, 0xb5, 0x01, 0x0a, 0x16, 0x4e, 0x65, 0x74,
|
||||
0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f,
|
||||
0x6e, 0x73, 0x65, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
|
||||
0x6d, 0x2f, 0x6e, 0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66,
|
||||
0x73, 0x2d, 0x6e, 0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69,
|
||||
0x63, 0x65, 0x73, 0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f,
|
||||
0x74, 0x6f, 0x33,
|
||||
0x6e, 0x73, 0x65, 0x12, 0x38, 0x0a, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28,
|
||||
0x0b, 0x32, 0x24, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x65, 0x74, 0x6d,
|
||||
0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
|
||||
0x73, 0x65, 0x2e, 0x42, 0x6f, 0x64, 0x79, 0x52, 0x04, 0x62, 0x6f, 0x64, 0x79, 0x12, 0x30, 0x0a,
|
||||
0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b,
|
||||
0x32, 0x12, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x53, 0x69, 0x67, 0x6e, 0x61,
|
||||
0x74, 0x75, 0x72, 0x65, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x1a,
|
||||
0x2f, 0x0a, 0x04, 0x42, 0x6f, 0x64, 0x79, 0x12, 0x27, 0x0a, 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61,
|
||||
0x70, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f,
|
||||
0x6c, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x52, 0x06, 0x6e, 0x65, 0x74, 0x6d, 0x61, 0x70,
|
||||
0x32, 0xad, 0x01, 0x0a, 0x0e, 0x43, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x53, 0x65, 0x72, 0x76,
|
||||
0x69, 0x63, 0x65, 0x12, 0x48, 0x0a, 0x0b, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x43, 0x68, 0x65,
|
||||
0x63, 0x6b, 0x12, 0x1b, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61,
|
||||
0x6c, 0x74, 0x68, 0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x1c, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x48, 0x65, 0x61, 0x6c, 0x74, 0x68,
|
||||
0x43, 0x68, 0x65, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x51, 0x0a,
|
||||
0x0e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x12,
|
||||
0x1e, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70,
|
||||
0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
|
||||
0x1f, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70,
|
||||
0x53, 0x6e, 0x61, 0x70, 0x73, 0x68, 0x6f, 0x74, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
|
||||
0x42, 0x36, 0x5a, 0x34, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x6e,
|
||||
0x73, 0x70, 0x63, 0x63, 0x2d, 0x64, 0x65, 0x76, 0x2f, 0x6e, 0x65, 0x6f, 0x66, 0x73, 0x2d, 0x6e,
|
||||
0x6f, 0x64, 0x65, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x73,
|
||||
0x2f, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
|
||||
}
|
||||
|
||||
var (
|
||||
|
@ -526,7 +526,7 @@ var file_pkg_services_control_service_proto_goTypes = []interface{}{
|
|||
(*NetmapSnapshotRequest_Body)(nil), // 6: control.NetmapSnapshotRequest.Body
|
||||
(*NetmapSnapshotResponse_Body)(nil), // 7: control.NetmapSnapshotResponse.Body
|
||||
(*Signature)(nil), // 8: control.Signature
|
||||
(HealthStatus)(0), // 9: control.HealthStatus
|
||||
(NetmapStatus)(0), // 9: control.NetmapStatus
|
||||
(*Netmap)(nil), // 10: control.Netmap
|
||||
}
|
||||
var file_pkg_services_control_service_proto_depIdxs = []int32{
|
||||
|
@ -538,7 +538,7 @@ var file_pkg_services_control_service_proto_depIdxs = []int32{
|
|||
8, // 5: control.NetmapSnapshotRequest.signature:type_name -> control.Signature
|
||||
7, // 6: control.NetmapSnapshotResponse.body:type_name -> control.NetmapSnapshotResponse.Body
|
||||
8, // 7: control.NetmapSnapshotResponse.signature:type_name -> control.Signature
|
||||
9, // 8: control.HealthCheckResponse.Body.status:type_name -> control.HealthStatus
|
||||
9, // 8: control.HealthCheckResponse.Body.netmap_status:type_name -> control.NetmapStatus
|
||||
10, // 9: control.NetmapSnapshotResponse.Body.netmap:type_name -> control.Netmap
|
||||
0, // 10: control.ControlService.HealthCheck:input_type -> control.HealthCheckRequest
|
||||
2, // 11: control.ControlService.NetmapSnapshot:input_type -> control.NetmapSnapshotRequest
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
48
pkg/services/control/types.pb.go
generated
48
pkg/services/control/types.pb.go
generated
|
@ -25,56 +25,56 @@ const (
|
|||
// of the legacy proto package is being used.
|
||||
const _ = proto.ProtoPackageIsVersion4
|
||||
|
||||
// Health status of the storage node.
|
||||
type HealthStatus int32
|
||||
// Status of the storage node in the NeoFS network map.
|
||||
type NetmapStatus int32
|
||||
|
||||
const (
|
||||
// Undefined status, default value.
|
||||
HealthStatus_STATUS_UNDEFINED HealthStatus = 0
|
||||
NetmapStatus_STATUS_UNDEFINED NetmapStatus = 0
|
||||
// Node is online.
|
||||
HealthStatus_ONLINE HealthStatus = 1
|
||||
NetmapStatus_ONLINE NetmapStatus = 1
|
||||
// Node is offline.
|
||||
HealthStatus_OFFLINE HealthStatus = 2
|
||||
NetmapStatus_OFFLINE NetmapStatus = 2
|
||||
)
|
||||
|
||||
// Enum value maps for HealthStatus.
|
||||
// Enum value maps for NetmapStatus.
|
||||
var (
|
||||
HealthStatus_name = map[int32]string{
|
||||
NetmapStatus_name = map[int32]string{
|
||||
0: "STATUS_UNDEFINED",
|
||||
1: "ONLINE",
|
||||
2: "OFFLINE",
|
||||
}
|
||||
HealthStatus_value = map[string]int32{
|
||||
NetmapStatus_value = map[string]int32{
|
||||
"STATUS_UNDEFINED": 0,
|
||||
"ONLINE": 1,
|
||||
"OFFLINE": 2,
|
||||
}
|
||||
)
|
||||
|
||||
func (x HealthStatus) Enum() *HealthStatus {
|
||||
p := new(HealthStatus)
|
||||
func (x NetmapStatus) Enum() *NetmapStatus {
|
||||
p := new(NetmapStatus)
|
||||
*p = x
|
||||
return p
|
||||
}
|
||||
|
||||
func (x HealthStatus) String() string {
|
||||
func (x NetmapStatus) String() string {
|
||||
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
|
||||
}
|
||||
|
||||
func (HealthStatus) Descriptor() protoreflect.EnumDescriptor {
|
||||
func (NetmapStatus) Descriptor() protoreflect.EnumDescriptor {
|
||||
return file_pkg_services_control_types_proto_enumTypes[0].Descriptor()
|
||||
}
|
||||
|
||||
func (HealthStatus) Type() protoreflect.EnumType {
|
||||
func (NetmapStatus) Type() protoreflect.EnumType {
|
||||
return &file_pkg_services_control_types_proto_enumTypes[0]
|
||||
}
|
||||
|
||||
func (x HealthStatus) Number() protoreflect.EnumNumber {
|
||||
func (x NetmapStatus) Number() protoreflect.EnumNumber {
|
||||
return protoreflect.EnumNumber(x)
|
||||
}
|
||||
|
||||
// Deprecated: Use HealthStatus.Descriptor instead.
|
||||
func (HealthStatus) EnumDescriptor() ([]byte, []int) {
|
||||
// Deprecated: Use NetmapStatus.Descriptor instead.
|
||||
func (NetmapStatus) EnumDescriptor() ([]byte, []int) {
|
||||
return file_pkg_services_control_types_proto_rawDescGZIP(), []int{0}
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ type NodeInfo struct {
|
|||
// will be considered invalid.
|
||||
Attributes []*NodeInfo_Attribute `protobuf:"bytes,3,rep,name=attributes,proto3" json:"attributes,omitempty"`
|
||||
// Carries state of the NeoFS node.
|
||||
State HealthStatus `protobuf:"varint,4,opt,name=state,proto3,enum=control.HealthStatus" json:"state,omitempty"`
|
||||
State NetmapStatus `protobuf:"varint,4,opt,name=state,proto3,enum=control.NetmapStatus" json:"state,omitempty"`
|
||||
}
|
||||
|
||||
func (x *NodeInfo) Reset() {
|
||||
|
@ -208,11 +208,11 @@ func (x *NodeInfo) GetAttributes() []*NodeInfo_Attribute {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *NodeInfo) GetState() HealthStatus {
|
||||
func (x *NodeInfo) GetState() NetmapStatus {
|
||||
if x != nil {
|
||||
return x.State
|
||||
}
|
||||
return HealthStatus_STATUS_UNDEFINED
|
||||
return NetmapStatus_STATUS_UNDEFINED
|
||||
}
|
||||
|
||||
// Network map structure.
|
||||
|
@ -398,7 +398,7 @@ var file_pkg_services_control_types_proto_rawDesc = []byte{
|
|||
0x2e, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65, 0x52, 0x0a, 0x61, 0x74, 0x74, 0x72,
|
||||
0x69, 0x62, 0x75, 0x74, 0x65, 0x73, 0x12, 0x2b, 0x0a, 0x05, 0x73, 0x74, 0x61, 0x74, 0x65, 0x18,
|
||||
0x04, 0x20, 0x01, 0x28, 0x0e, 0x32, 0x15, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e,
|
||||
0x48, 0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x73, 0x74,
|
||||
0x4e, 0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x52, 0x05, 0x73, 0x74,
|
||||
0x61, 0x74, 0x65, 0x1a, 0x4d, 0x0a, 0x09, 0x41, 0x74, 0x74, 0x72, 0x69, 0x62, 0x75, 0x74, 0x65,
|
||||
0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b,
|
||||
0x65, 0x79, 0x12, 0x14, 0x0a, 0x05, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28,
|
||||
|
@ -408,8 +408,8 @@ var file_pkg_services_control_types_proto_rawDesc = []byte{
|
|||
0x65, 0x70, 0x6f, 0x63, 0x68, 0x18, 0x01, 0x20, 0x01, 0x28, 0x04, 0x52, 0x05, 0x65, 0x70, 0x6f,
|
||||
0x63, 0x68, 0x12, 0x27, 0x0a, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x18, 0x02, 0x20, 0x03, 0x28,
|
||||
0x0b, 0x32, 0x11, 0x2e, 0x63, 0x6f, 0x6e, 0x74, 0x72, 0x6f, 0x6c, 0x2e, 0x4e, 0x6f, 0x64, 0x65,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x2a, 0x3d, 0x0a, 0x0c, 0x48,
|
||||
0x65, 0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x10, 0x53,
|
||||
0x49, 0x6e, 0x66, 0x6f, 0x52, 0x05, 0x6e, 0x6f, 0x64, 0x65, 0x73, 0x2a, 0x3d, 0x0a, 0x0c, 0x4e,
|
||||
0x65, 0x74, 0x6d, 0x61, 0x70, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x14, 0x0a, 0x10, 0x53,
|
||||
0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45, 0x46, 0x49, 0x4e, 0x45, 0x44, 0x10,
|
||||
0x00, 0x12, 0x0a, 0x0a, 0x06, 0x4f, 0x4e, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x01, 0x12, 0x0b, 0x0a,
|
||||
0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x42, 0x36, 0x5a, 0x34, 0x67, 0x69,
|
||||
|
@ -434,7 +434,7 @@ func file_pkg_services_control_types_proto_rawDescGZIP() []byte {
|
|||
var file_pkg_services_control_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
|
||||
var file_pkg_services_control_types_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
|
||||
var file_pkg_services_control_types_proto_goTypes = []interface{}{
|
||||
(HealthStatus)(0), // 0: control.HealthStatus
|
||||
(NetmapStatus)(0), // 0: control.NetmapStatus
|
||||
(*Signature)(nil), // 1: control.Signature
|
||||
(*NodeInfo)(nil), // 2: control.NodeInfo
|
||||
(*Netmap)(nil), // 3: control.Netmap
|
||||
|
@ -442,7 +442,7 @@ var file_pkg_services_control_types_proto_goTypes = []interface{}{
|
|||
}
|
||||
var file_pkg_services_control_types_proto_depIdxs = []int32{
|
||||
4, // 0: control.NodeInfo.attributes:type_name -> control.NodeInfo.Attribute
|
||||
0, // 1: control.NodeInfo.state:type_name -> control.HealthStatus
|
||||
0, // 1: control.NodeInfo.state:type_name -> control.NetmapStatus
|
||||
2, // 2: control.Netmap.nodes:type_name -> control.NodeInfo
|
||||
3, // [3:3] is the sub-list for method output_type
|
||||
3, // [3:3] is the sub-list for method input_type
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue