Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteItemFronIndex(hash interface{}) *dataobj.TsdbItem
- func GetIndex()
- func GetIndexLoop()
- func GetItemFronIndex(hash interface{}) *dataobj.TsdbItem
- func Init(cfg IndexSection)
- func RebuildAllIndex(params ...[]string) error
- func ReceiveItem(item *dataobj.TsdbItem, hash interface{})
- func StartIndexUpdateIncrTask()
- func StartUpdateIndexTask()
- type DsTypeAndStep
- type IndexAddrs
- type IndexCacheBase
- func (this *IndexCacheBase) ContainsKey(key interface{}) bool
- func (this *IndexCacheBase) Get(key interface{}) *dataobj.TsdbItem
- func (this *IndexCacheBase) Keys() []interface{}
- func (this *IndexCacheBase) Put(key interface{}, item *dataobj.TsdbItem)
- func (this *IndexCacheBase) Remove(key interface{})
- func (this *IndexCacheBase) Size() int
- type IndexCacheItem
- type IndexSection
Constants ¶
View Source
const (
DefaultMaxCacheSize = 5000000 // 默认 最多500w个,太大了内存会耗尽
)
View Source
const INDEX_SHARD = 256
View Source
const (
IndexUpdateIncrTaskSleepInterval = time.Duration(10) * time.Second // 增量更新间隔时间, 默认30s
)
Variables ¶
View Source
var IndexedItemCacheBigMap = make([]*IndexCacheBase, INDEX_SHARD)
View Source
var UnIndexedItemCacheBigMap = make([]*IndexCacheBase, INDEX_SHARD)
View Source
var UpdateIndexLock = semaphore.NewSemaphore(1)
重建索引全局锁
Functions ¶
func DeleteItemFronIndex ¶
func GetIndexLoop ¶
func GetIndexLoop()
func GetItemFronIndex ¶
func RebuildAllIndex ¶
func ReceiveItem ¶
index收到一条新上报的监控数据,尝试用于增量更新索引
func StartIndexUpdateIncrTask ¶
func StartIndexUpdateIncrTask()
启动索引的 异步、增量更新 任务, 每隔一定时间,刷新cache中的数据到数据库中
func StartUpdateIndexTask ¶
func StartUpdateIndexTask()
Types ¶
type DsTypeAndStep ¶
type IndexAddrs ¶
var IndexList IndexAddrs
func (*IndexAddrs) Get ¶
func (i *IndexAddrs) Get() []string
func (*IndexAddrs) Set ¶
func (i *IndexAddrs) Set(addrs []string)
type IndexCacheBase ¶
索引缓存-基本缓存容器
func NewIndexCacheBase ¶
func NewIndexCacheBase(max int) *IndexCacheBase
func (*IndexCacheBase) ContainsKey ¶
func (this *IndexCacheBase) ContainsKey(key interface{}) bool
func (*IndexCacheBase) Get ¶
func (this *IndexCacheBase) Get(key interface{}) *dataobj.TsdbItem
func (*IndexCacheBase) Keys ¶
func (this *IndexCacheBase) Keys() []interface{}
func (*IndexCacheBase) Put ¶
func (this *IndexCacheBase) Put(key interface{}, item *dataobj.TsdbItem)
func (*IndexCacheBase) Remove ¶
func (this *IndexCacheBase) Remove(key interface{})
func (*IndexCacheBase) Size ¶
func (this *IndexCacheBase) Size() int
type IndexCacheItem ¶
索引缓存的元素数据结构
func NewIndexCacheItem ¶
func NewIndexCacheItem(uuid interface{}, item *dataobj.TsdbItem) *IndexCacheItem
type IndexSection ¶
type IndexSection struct { ActiveDuration int64 `yaml:"activeDuration"` //内存索引保留时间 RebuildInterval int64 `yaml:"rebuildInterval"` //索引重建周期 HbsMod string `yaml:"hbsMod"` }
var Config IndexSection
Click to show internal directories.
Click to hide internal directories.