2025-11-17 16:39:26 +08:00
|
|
|
// Package constants define constant variable
|
|
|
|
|
package constants
|
|
|
|
|
|
2026-02-12 17:09:08 +08:00
|
|
|
// EvenvtType define event type
|
|
|
|
|
type EvenvtType int
|
|
|
|
|
|
2025-11-17 16:39:26 +08:00
|
|
|
const (
|
2026-02-12 17:09:08 +08:00
|
|
|
// EventGeneralHard define gereral hard event type
|
|
|
|
|
EventGeneralHard EvenvtType = iota
|
|
|
|
|
// EventGeneralPlatformSoft define gereral platform soft event type
|
|
|
|
|
EventGeneralPlatformSoft
|
|
|
|
|
// EventGeneralApplicationSoft define gereral application soft event type
|
|
|
|
|
EventGeneralApplicationSoft
|
|
|
|
|
// EventWarnHard define warn hard event type
|
|
|
|
|
EventWarnHard
|
|
|
|
|
// EventWarnPlatformSoft define warn platform soft event type
|
|
|
|
|
EventWarnPlatformSoft
|
|
|
|
|
// EventWarnApplicationSoft define warn application soft event type
|
|
|
|
|
EventWarnApplicationSoft
|
|
|
|
|
// EventCriticalHard define critical hard event type
|
|
|
|
|
EventCriticalHard
|
|
|
|
|
// EventCriticalPlatformSoft define critical platform soft event type
|
|
|
|
|
EventCriticalPlatformSoft
|
|
|
|
|
// EventCriticalApplicationSoft define critical application soft event type
|
|
|
|
|
EventCriticalApplicationSoft
|
2025-11-17 16:39:26 +08:00
|
|
|
)
|
|
|
|
|
|
2026-02-12 17:09:08 +08:00
|
|
|
// IsGeneral define fucn to check event type is general
|
|
|
|
|
func IsGeneral(eventType EvenvtType) bool {
|
|
|
|
|
return eventType < 3
|
|
|
|
|
}
|
2025-11-17 16:39:26 +08:00
|
|
|
|
2026-02-12 17:09:08 +08:00
|
|
|
// IsWarning define fucn to check event type is warn
|
|
|
|
|
func IsWarning(eventType EvenvtType) bool {
|
|
|
|
|
return eventType >= 3 && eventType <= 5
|
|
|
|
|
}
|
2025-11-17 16:39:26 +08:00
|
|
|
|
2026-02-12 17:09:08 +08:00
|
|
|
// IsCritical define fucn to check event type is critical
|
|
|
|
|
func IsCritical(eventType EvenvtType) bool {
|
|
|
|
|
return eventType >= 6
|
|
|
|
|
}
|
2025-11-17 16:39:26 +08:00
|
|
|
|
|
|
|
|
const (
|
2026-02-12 17:09:08 +08:00
|
|
|
// EventFromStation define event from station type
|
|
|
|
|
EventFromStation = "station"
|
|
|
|
|
// EventFromPlatform define event from platform type
|
|
|
|
|
EventFromPlatform = "platform"
|
|
|
|
|
// EventFromOthers define event from others type
|
|
|
|
|
EventFromOthers = "others"
|
2025-11-17 16:39:26 +08:00
|
|
|
)
|
2026-02-24 17:08:48 +08:00
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
// EventStatusHappended define status for event record when event just happened, no data attached yet
|
|
|
|
|
EventStatusHappended = iota
|
|
|
|
|
// EventStatusDataAttached define status for event record when event just happened, data attached already
|
|
|
|
|
EventStatusDataAttached
|
|
|
|
|
// EventStatusReported define status for event record when event reported to CIM, no matter it's successful or failed
|
|
|
|
|
EventStatusReported
|
|
|
|
|
// EventStatusConfirmed define status for event record when event confirmed by CIM, no matter it's successful or failed
|
|
|
|
|
EventStatusConfirmed
|
|
|
|
|
// EventStatusPersisted define status for event record when event persisted in database, no matter it's successful or failed
|
|
|
|
|
EventStatusPersisted
|
|
|
|
|
// EventStatusClosed define status for event record when event closed, no matter it's successful or failed
|
|
|
|
|
EventStatusClosed
|
|
|
|
|
)
|