[#312] control: Define HealthStatus enum

Define enumeration of the statuses of storage node application.

Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
Leonard Lyubich 2021-01-15 13:13:41 +03:00 committed by Alex Vanin
parent 71fcbd3ed4
commit 0abb8acef3
3 changed files with 93 additions and 14 deletions

View file

@ -306,7 +306,7 @@ type HealthCheckResponse_Body struct {
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
// Network map status of storage node.
// Status of the storage node in NeoFS network map.
NetmapStatus NetmapStatus `protobuf:"varint,1,opt,name=netmap_status,json=netmapStatus,proto3,enum=control.NetmapStatus" json:"netmap_status,omitempty"`
}

View file

@ -78,6 +78,63 @@ func (NetmapStatus) EnumDescriptor() ([]byte, []int) {
return file_pkg_services_control_types_proto_rawDescGZIP(), []int{0}
}
// Health status of the storage node application.
type HealthStatus int32
const (
// Undefined status, default value.
HealthStatus_HEALTH_STATUS_UNDEFINED HealthStatus = 0
// Storage node application is starting.
HealthStatus_STARTING HealthStatus = 1
// Storage node application is started and serves all services.
HealthStatus_READY HealthStatus = 2
// Storage node application is shutting down.
HealthStatus_SHUTTING_DOWN HealthStatus = 3
)
// Enum value maps for HealthStatus.
var (
HealthStatus_name = map[int32]string{
0: "HEALTH_STATUS_UNDEFINED",
1: "STARTING",
2: "READY",
3: "SHUTTING_DOWN",
}
HealthStatus_value = map[string]int32{
"HEALTH_STATUS_UNDEFINED": 0,
"STARTING": 1,
"READY": 2,
"SHUTTING_DOWN": 3,
}
)
func (x HealthStatus) Enum() *HealthStatus {
p := new(HealthStatus)
*p = x
return p
}
func (x HealthStatus) String() string {
return protoimpl.X.EnumStringOf(x.Descriptor(), protoreflect.EnumNumber(x))
}
func (HealthStatus) Descriptor() protoreflect.EnumDescriptor {
return file_pkg_services_control_types_proto_enumTypes[1].Descriptor()
}
func (HealthStatus) Type() protoreflect.EnumType {
return &file_pkg_services_control_types_proto_enumTypes[1]
}
func (x HealthStatus) Number() protoreflect.EnumNumber {
return protoreflect.EnumNumber(x)
}
// Deprecated: Use HealthStatus.Descriptor instead.
func (HealthStatus) EnumDescriptor() ([]byte, []int) {
return file_pkg_services_control_types_proto_rawDescGZIP(), []int{1}
}
// Signature of some message.
type Signature struct {
state protoimpl.MessageState
@ -412,11 +469,17 @@ var file_pkg_services_control_types_proto_rawDesc = []byte{
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,
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,
0x07, 0x4f, 0x46, 0x46, 0x4c, 0x49, 0x4e, 0x45, 0x10, 0x02, 0x2a, 0x57, 0x0a, 0x0c, 0x48, 0x65,
0x61, 0x6c, 0x74, 0x68, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x12, 0x1b, 0x0a, 0x17, 0x48, 0x45,
0x41, 0x4c, 0x54, 0x48, 0x5f, 0x53, 0x54, 0x41, 0x54, 0x55, 0x53, 0x5f, 0x55, 0x4e, 0x44, 0x45,
0x46, 0x49, 0x4e, 0x45, 0x44, 0x10, 0x00, 0x12, 0x0c, 0x0a, 0x08, 0x53, 0x54, 0x41, 0x52, 0x54,
0x49, 0x4e, 0x47, 0x10, 0x01, 0x12, 0x09, 0x0a, 0x05, 0x52, 0x45, 0x41, 0x44, 0x59, 0x10, 0x02,
0x12, 0x11, 0x0a, 0x0d, 0x53, 0x48, 0x55, 0x54, 0x54, 0x49, 0x4e, 0x47, 0x5f, 0x44, 0x4f, 0x57,
0x4e, 0x10, 0x03, 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 (
@ -431,19 +494,20 @@ func file_pkg_services_control_types_proto_rawDescGZIP() []byte {
return file_pkg_services_control_types_proto_rawDescData
}
var file_pkg_services_control_types_proto_enumTypes = make([]protoimpl.EnumInfo, 1)
var file_pkg_services_control_types_proto_enumTypes = make([]protoimpl.EnumInfo, 2)
var file_pkg_services_control_types_proto_msgTypes = make([]protoimpl.MessageInfo, 4)
var file_pkg_services_control_types_proto_goTypes = []interface{}{
(NetmapStatus)(0), // 0: control.NetmapStatus
(*Signature)(nil), // 1: control.Signature
(*NodeInfo)(nil), // 2: control.NodeInfo
(*Netmap)(nil), // 3: control.Netmap
(*NodeInfo_Attribute)(nil), // 4: control.NodeInfo.Attribute
(HealthStatus)(0), // 1: control.HealthStatus
(*Signature)(nil), // 2: control.Signature
(*NodeInfo)(nil), // 3: control.NodeInfo
(*Netmap)(nil), // 4: control.Netmap
(*NodeInfo_Attribute)(nil), // 5: control.NodeInfo.Attribute
}
var file_pkg_services_control_types_proto_depIdxs = []int32{
4, // 0: control.NodeInfo.attributes:type_name -> control.NodeInfo.Attribute
5, // 0: control.NodeInfo.attributes:type_name -> control.NodeInfo.Attribute
0, // 1: control.NodeInfo.state:type_name -> control.NetmapStatus
2, // 2: control.Netmap.nodes:type_name -> control.NodeInfo
3, // 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
3, // [3:3] is the sub-list for extension type_name
@ -511,7 +575,7 @@ func file_pkg_services_control_types_proto_init() {
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_pkg_services_control_types_proto_rawDesc,
NumEnums: 1,
NumEnums: 2,
NumMessages: 4,
NumExtensions: 0,
NumServices: 0,

View file

@ -101,3 +101,18 @@ message Netmap {
// Nodes presented in network.
repeated NodeInfo nodes = 2 [json_name = "nodes"];
}
// Health status of the storage node application.
enum HealthStatus {
// Undefined status, default value.
HEALTH_STATUS_UNDEFINED = 0;
// Storage node application is starting.
STARTING = 1;
// Storage node application is started and serves all services.
READY = 2;
// Storage node application is shutting down.
SHUTTING_DOWN = 3;
}