cache

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2017 License: Apache-2.0, Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Agents = NewSafeAgents()
View Source
var ExpressionCache = &SafeExpressionCache{}
View Source
var GroupPlugins = &SafeGroupPlugins{M: make(map[int][]string)}
View Source
var GroupTemplates = &SafeGroupTemplates{M: make(map[int][]int)}
View Source
var HostGroupsMap = &SafeHostGroupsMap{M: make(map[int][]int)}
View Source
var HostMap = &SafeHostMap{M: make(map[string]int)}
View Source
var HostTemplateIds = &SafeHostTemplateIds{M: make(map[int][]int)}
View Source
var MonitoredHosts = &SafeMonitoredHosts{M: make(map[int]*model.Host)}
View Source
var Strategies = &SafeStrategies{M: make(map[int]*model.Strategy)}
View Source
var TemplateCache = &SafeTemplateCache{M: make(map[int]*model.Template)}

Functions

func DeleteStaleAgents

func DeleteStaleAgents()

func GetBuiltinMetrics

func GetBuiltinMetrics(hostname string) ([]*model.BuiltinMetric, error)

func GetPlugins

func GetPlugins(hostname string) []string

根据hostname获取关联的插件

func Init

func Init()

func LoopInit

func LoopInit()

func ParentIds

func ParentIds(allTpls map[int]*model.Template, tid int) (ret []int)

Types

type SafeAgents

type SafeAgents struct {
	sync.RWMutex
	M map[string]*model.AgentUpdateInfo
}

func NewSafeAgents

func NewSafeAgents() *SafeAgents

func (*SafeAgents) Delete

func (this *SafeAgents) Delete(hostname string)

func (*SafeAgents) Get

func (this *SafeAgents) Get(hostname string) (*model.AgentUpdateInfo, bool)

func (*SafeAgents) Keys

func (this *SafeAgents) Keys() []string

func (*SafeAgents) Put

func (this *SafeAgents) Put(req *model.AgentReportRequest)

type SafeExpressionCache

type SafeExpressionCache struct {
	sync.RWMutex
	L []*model.Expression
}

func (*SafeExpressionCache) Get

func (this *SafeExpressionCache) Get() []*model.Expression

func (*SafeExpressionCache) Init

func (this *SafeExpressionCache) Init()

type SafeGroupPlugins

type SafeGroupPlugins struct {
	sync.RWMutex
	M map[int][]string
}

一个HostGroup可以绑定多个Plugin

func (*SafeGroupPlugins) GetPlugins

func (this *SafeGroupPlugins) GetPlugins(gid int) ([]string, bool)

func (*SafeGroupPlugins) Init

func (this *SafeGroupPlugins) Init()

type SafeGroupTemplates

type SafeGroupTemplates struct {
	sync.RWMutex
	M map[int][]int
}

一个HostGroup对应多个Template

func (*SafeGroupTemplates) GetTemplateIds

func (this *SafeGroupTemplates) GetTemplateIds(gid int) ([]int, bool)

func (*SafeGroupTemplates) Init

func (this *SafeGroupTemplates) Init()

type SafeHostGroupsMap

type SafeHostGroupsMap struct {
	sync.RWMutex
	M map[int][]int
}

一个机器可能在多个group下,做一个map缓存hostid与groupid的对应关系

func (*SafeHostGroupsMap) GetGroupIds

func (this *SafeHostGroupsMap) GetGroupIds(hid int) ([]int, bool)

func (*SafeHostGroupsMap) Init

func (this *SafeHostGroupsMap) Init()

type SafeHostMap

type SafeHostMap struct {
	sync.RWMutex
	M map[string]int
}

每次心跳的时候agent把hostname汇报上来,经常要知道这个机器的hostid,把此信息缓存 key: hostname value: hostid

func (*SafeHostMap) GetID

func (this *SafeHostMap) GetID(hostname string) (int, bool)

func (*SafeHostMap) Init

func (this *SafeHostMap) Init()

type SafeHostTemplateIds

type SafeHostTemplateIds struct {
	sync.RWMutex
	M map[int][]int
}

func (*SafeHostTemplateIds) GetMap

func (this *SafeHostTemplateIds) GetMap() map[int][]int

func (*SafeHostTemplateIds) Init

func (this *SafeHostTemplateIds) Init()

type SafeMonitoredHosts

type SafeMonitoredHosts struct {
	sync.RWMutex
	M map[int]*model.Host
}

func (*SafeMonitoredHosts) Get

func (this *SafeMonitoredHosts) Get() map[int]*model.Host

func (*SafeMonitoredHosts) Init

func (this *SafeMonitoredHosts) Init()

type SafeStrategies

type SafeStrategies struct {
	sync.RWMutex
	M map[int]*model.Strategy
}

func (*SafeStrategies) GetMap

func (this *SafeStrategies) GetMap() map[int]*model.Strategy

func (*SafeStrategies) Init

func (this *SafeStrategies) Init(tpls map[int]*model.Template)

type SafeTemplateCache

type SafeTemplateCache struct {
	sync.RWMutex
	M map[int]*model.Template
}

func (*SafeTemplateCache) GetMap

func (this *SafeTemplateCache) GetMap() map[int]*model.Template

func (*SafeTemplateCache) Init

func (this *SafeTemplateCache) Init()

Jump to

Keyboard shortcuts

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