refactor: replace EventStatusPersisted with IsPersisted field on EventRecord - add IsPersisted bool to EventRecord for explicit persistence tracking by eventRT consumer - remove EventStatusPersisted constant, decoupling DB persistence from event lifecycle status - update event status comments for accuracy and CIM-agnostic language

This commit is contained in:
douxu 2026-05-08 16:19:12 +08:00
parent 1ee722dd58
commit 1dd8491440
2 changed files with 6 additions and 6 deletions

View File

@ -52,15 +52,13 @@ const (
const ( const (
// EventStatusHappended define status for event record when event just happened, no data attached yet // EventStatusHappended define status for event record when event just happened, no data attached yet
EventStatusHappended = iota EventStatusHappended = iota
// EventStatusDataAttached define status for event record when event just happened, data attached already // EventStatusDataAttached define status for event record when event data attached, ready to be sent
EventStatusDataAttached EventStatusDataAttached
// EventStatusReported define status for event record when event reported to CIM, no matter it's successful or failed // EventStatusReported define status for event record when event reported to downstream, no matter it's successful or failed
EventStatusReported EventStatusReported
// EventStatusConfirmed define status for event record when event confirmed by CIM, no matter it's successful or failed // EventStatusConfirmed define status for event record when event confirmed by operator or CIM
EventStatusConfirmed EventStatusConfirmed
// EventStatusPersisted define status for event record when event persisted in database, no matter it's successful or failed // EventStatusClosed define status for event record when event closed due to condition recovery or manual close
EventStatusPersisted
// EventStatusClosed define status for event record when event closed, no matter it's successful or failed
EventStatusClosed EventStatusClosed
) )

View File

@ -13,6 +13,8 @@ type EventRecord struct {
Priority int `json:"priority"` Priority int `json:"priority"`
// 事件状态 // 事件状态
Status int `json:"status"` Status int `json:"status"`
// 是否已持久化到数据库,由 eventRT 消费并落库后置为 true
IsPersisted bool `json:"is_persisted"`
// 可选模板参数 // 可选模板参数
Category string `json:"category,omitempty"` Category string `json:"category,omitempty"`
// 毫秒级时间戳 (Unix epoch) // 毫秒级时间戳 (Unix epoch)