cache

package
v0.0.0-...-b6b44b4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var HistoryBigMap = make(map[string]*JudgeItemMap)

这是个线程不安全的大Map,需要提前初始化好

View Source
var (
	LastEvents = &SafeEventMap{M: make(map[string]*dataobj.Event)}
)

Functions

func InitHistoryBigMap

func InitHistoryBigMap()

Types

type IndexMap

type IndexMap struct {
	sync.RWMutex
	Data map[int64]map[string]Series
}
var SeriesMap *IndexMap

func NewIndexMap

func NewIndexMap() *IndexMap

func (*IndexMap) Clean

func (i *IndexMap) Clean()

func (*IndexMap) CleanLoop

func (i *IndexMap) CleanLoop()

func (*IndexMap) Get

func (i *IndexMap) Get(id int64) []Series

func (*IndexMap) Set

func (i *IndexMap) Set(id int64, hash string, s Series)

type JudgeItemMap

type JudgeItemMap struct {
	sync.RWMutex
	M map[string]*SafeLinkedList
}

func NewJudgeItemMap

func NewJudgeItemMap() *JudgeItemMap

func (*JudgeItemMap) BatchDelete

func (j *JudgeItemMap) BatchDelete(keys []string)

func (*JudgeItemMap) CleanStale

func (j *JudgeItemMap) CleanStale(before int64)

func (*JudgeItemMap) Get

func (j *JudgeItemMap) Get(key string) (*SafeLinkedList, bool)

func (*JudgeItemMap) Len

func (j *JudgeItemMap) Len() int

func (*JudgeItemMap) Set

func (j *JudgeItemMap) Set(key string, val *SafeLinkedList)

type SafeEventMap

type SafeEventMap struct {
	sync.RWMutex
	M map[string]*dataobj.Event
}

func (*SafeEventMap) Get

func (s *SafeEventMap) Get(key string) (*dataobj.Event, bool)

func (*SafeEventMap) Set

func (s *SafeEventMap) Set(key string, event *dataobj.Event)

type SafeLinkedList

type SafeLinkedList struct {
	sync.RWMutex
	L *list.List
}

func (*SafeLinkedList) Front

func (ll *SafeLinkedList) Front() *list.Element

func (*SafeLinkedList) HistoryData

func (ll *SafeLinkedList) HistoryData(limit int) ([]*dataobj.HistoryData, bool)

@param limit 至多返回这些,如果不够,有多少返回多少 @return bool isEnough

func (*SafeLinkedList) Len

func (ll *SafeLinkedList) Len() int

func (*SafeLinkedList) PushFrontAndMaintain

func (ll *SafeLinkedList) PushFrontAndMaintain(v *dataobj.JudgeItem, maxCount int) bool

@return needJudge 如果是false不需要做judge,因为新上来的数据不合法

func (*SafeLinkedList) QueryDataByTS

func (ll *SafeLinkedList) QueryDataByTS(start, end int64) []*dataobj.HistoryData

type Series

type Series struct {
	Endpoint string
	Metric   string
	Tag      string
	Step     int
	Dstype   string
	TS       int64
}

type StrategyMap

type StrategyMap struct {
	sync.RWMutex
	Data map[int64]*model.Stra
	TS   map[int64]int64
}
var NodataStra *StrategyMap
var Strategy *StrategyMap

func NewStrategyMap

func NewStrategyMap() *StrategyMap

func (*StrategyMap) Clean

func (s *StrategyMap) Clean()

func (*StrategyMap) Get

func (s *StrategyMap) Get(id int64) (*model.Stra, bool)

func (*StrategyMap) GetAll

func (s *StrategyMap) GetAll() []*model.Stra

func (*StrategyMap) Set

func (s *StrategyMap) Set(id int64, stra *model.Stra)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL