modelRT/real-time-data/compute_state_manager.go

34 lines
965 B
Go

// Package realtimedata define real time data operation functions
package realtimedata
import (
"modelRT/util"
)
// ComputeConfig define struct of measurement computation
type ComputeConfig struct {
Cause map[string]any
Action map[string]any
// TODO 预留自由调整的入口
// min consecutive breach count
minBreachCount int
Duration int
DataSize int64
QueryKey string
StopGchan chan struct{}
Analyzer RealTimeAnalyzer
}
// 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.
type MeasComputeState struct {
util.TypedMap[string, *ComputeConfig]
}
// NewMeasComputeState define func to create and returns a new instance of MeasComputeState
func NewMeasComputeState() *MeasComputeState {
return &MeasComputeState{}
}