Documentation ¶
Index ¶
- Variables
- func CheckExpression(L *SafeLinkedList, firstItem *model.JudgeItem, now int64)
- func CheckStrategy(L *SafeLinkedList, firstItem *model.JudgeItem, now int64)
- func InitHistoryBigMap()
- func Judge(L *SafeLinkedList, firstItem *model.JudgeItem, now int64)
- type AllFunction
- type AvgFunction
- type DiffFunction
- type Function
- type JudgeItemMap
- func (this *JudgeItemMap) BatchDelete(keys []string)
- func (this *JudgeItemMap) CleanStale(before int64)
- func (this *JudgeItemMap) Delete(key string)
- func (this *JudgeItemMap) Get(key string) (*SafeLinkedList, bool)
- func (this *JudgeItemMap) Len() int
- func (this *JudgeItemMap) PushFrontAndMaintain(key string, val *model.JudgeItem, maxCount int, now int64)
- func (this *JudgeItemMap) Set(key string, val *SafeLinkedList)
- type MaxFunction
- type MinFunction
- type PDiffFunction
- type SafeLinkedList
- func (this *SafeLinkedList) Front() *list.Element
- func (this *SafeLinkedList) HistoryData(limit int) ([]*model.HistoryData, bool)
- func (this *SafeLinkedList) Len() int
- func (this *SafeLinkedList) PushFront(v interface{}) *list.Element
- func (this *SafeLinkedList) PushFrontAndMaintain(v *model.JudgeItem, maxCount int) bool
- func (this *SafeLinkedList) ToSlice() []*model.JudgeItem
- type SumFunction
Constants ¶
This section is empty.
Variables ¶
View Source
var HistoryBigMap = make(map[string]*JudgeItemMap)
这是个线程不安全的大Map,需要提前初始化好
Functions ¶
func CheckExpression ¶
func CheckExpression(L *SafeLinkedList, firstItem *model.JudgeItem, now int64)
func CheckStrategy ¶
func CheckStrategy(L *SafeLinkedList, firstItem *model.JudgeItem, now int64)
func InitHistoryBigMap ¶
func InitHistoryBigMap()
Types ¶
type AllFunction ¶
func (AllFunction) Compute ¶
func (this AllFunction) Compute(L *SafeLinkedList) (vs []*model.HistoryData, leftValue float64, isTriggered bool, isEnough bool)
type AvgFunction ¶
func (AvgFunction) Compute ¶
func (this AvgFunction) Compute(L *SafeLinkedList) (vs []*model.HistoryData, leftValue float64, isTriggered bool, isEnough bool)
type DiffFunction ¶
func (DiffFunction) Compute ¶
func (this DiffFunction) Compute(L *SafeLinkedList) (vs []*model.HistoryData, leftValue float64, isTriggered bool, isEnough bool)
只要有一个点的diff触发阈值,就报警
type Function ¶
type Function interface {
Compute(L *SafeLinkedList) (vs []*model.HistoryData, leftValue float64, isTriggered bool, isEnough bool)
}
type JudgeItemMap ¶
type JudgeItemMap struct { sync.RWMutex M map[string]*SafeLinkedList }
func NewJudgeItemMap ¶
func NewJudgeItemMap() *JudgeItemMap
func (*JudgeItemMap) BatchDelete ¶
func (this *JudgeItemMap) BatchDelete(keys []string)
func (*JudgeItemMap) CleanStale ¶
func (this *JudgeItemMap) CleanStale(before int64)
func (*JudgeItemMap) Delete ¶
func (this *JudgeItemMap) Delete(key string)
func (*JudgeItemMap) Get ¶
func (this *JudgeItemMap) Get(key string) (*SafeLinkedList, bool)
func (*JudgeItemMap) Len ¶
func (this *JudgeItemMap) Len() int
func (*JudgeItemMap) PushFrontAndMaintain ¶
func (*JudgeItemMap) Set ¶
func (this *JudgeItemMap) Set(key string, val *SafeLinkedList)
type MaxFunction ¶
func (MaxFunction) Compute ¶
func (this MaxFunction) Compute(L *SafeLinkedList) (vs []*model.HistoryData, leftValue float64, isTriggered bool, isEnough bool)
type MinFunction ¶
func (MinFunction) Compute ¶
func (this MinFunction) Compute(L *SafeLinkedList) (vs []*model.HistoryData, leftValue float64, isTriggered bool, isEnough bool)
type PDiffFunction ¶
pdiff(#3)
func (PDiffFunction) Compute ¶
func (this PDiffFunction) Compute(L *SafeLinkedList) (vs []*model.HistoryData, leftValue float64, isTriggered bool, isEnough bool)
type SafeLinkedList ¶
func (*SafeLinkedList) Front ¶
func (this *SafeLinkedList) Front() *list.Element
func (*SafeLinkedList) HistoryData ¶
func (this *SafeLinkedList) HistoryData(limit int) ([]*model.HistoryData, bool)
@param limit 至多返回这些,如果不够,有多少返回多少 @return bool isEnough
func (*SafeLinkedList) Len ¶
func (this *SafeLinkedList) Len() int
func (*SafeLinkedList) PushFront ¶
func (this *SafeLinkedList) PushFront(v interface{}) *list.Element
func (*SafeLinkedList) PushFrontAndMaintain ¶
func (this *SafeLinkedList) PushFrontAndMaintain(v *model.JudgeItem, maxCount int) bool
@return needJudge 如果是false不需要做judge,因为新上来的数据不合法
func (*SafeLinkedList) ToSlice ¶
func (this *SafeLinkedList) ToSlice() []*model.JudgeItem
type SumFunction ¶
func (SumFunction) Compute ¶
func (this SumFunction) Compute(L *SafeLinkedList) (vs []*model.HistoryData, leftValue float64, isTriggered bool, isEnough bool)
Click to show internal directories.
Click to hide internal directories.