2025-11-13 17:29:49 +08:00
|
|
|
// Package realtimedata define real time data operation functions
|
|
|
|
|
package realtimedata
|
|
|
|
|
|
2025-11-14 16:34:34 +08:00
|
|
|
import (
|
2026-06-18 16:06:06 +08:00
|
|
|
"modelRT/util"
|
2025-11-14 16:34:34 +08:00
|
|
|
)
|
2025-11-13 17:29:49 +08:00
|
|
|
|
|
|
|
|
// ComputeConfig define struct of measurement computation
|
|
|
|
|
type ComputeConfig struct {
|
2025-11-14 16:34:34 +08:00
|
|
|
Cause map[string]any
|
|
|
|
|
Action map[string]any
|
|
|
|
|
// TODO 预留自由调整的入口
|
2025-11-17 16:39:26 +08:00
|
|
|
// min consecutive breach count
|
|
|
|
|
minBreachCount int
|
|
|
|
|
Duration int
|
|
|
|
|
DataSize int64
|
|
|
|
|
QueryKey string
|
|
|
|
|
StopGchan chan struct{}
|
|
|
|
|
Analyzer RealTimeAnalyzer
|
2025-11-13 17:29:49 +08:00
|
|
|
}
|
|
|
|
|
|
2026-06-18 16:06:06 +08:00
|
|
|
// MeasComputeState define struct of manages the state of measurement
|
|
|
|
|
// computations. It embeds util.TypedMap to inherit the concurrency-safe,
|
|
|
|
|
// type-safe Store/Load/Delete/LoadOrStore/Range/All/Len operations without
|
|
|
|
|
// per-call-site type assertions.
|
2025-11-13 17:29:49 +08:00
|
|
|
type MeasComputeState struct {
|
2026-06-18 16:06:06 +08:00
|
|
|
util.TypedMap[string, *ComputeConfig]
|
2025-11-13 17:29:49 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// NewMeasComputeState define func to create and returns a new instance of MeasComputeState
|
|
|
|
|
func NewMeasComputeState() *MeasComputeState {
|
|
|
|
|
return &MeasComputeState{}
|
|
|
|
|
}
|