Documentation ¶
Index ¶
- Constants
- Variables
- func DeleteItemFronIndex(hash string)
- func GetIndex()
- func GetIndexLoop()
- func GetItemFronIndex(hash string) *dataobj.TsdbItem
- func Init(cfg IndexSection)
- func RebuildAllIndex(params ...[]string) error
- func ReceiveItem(item *dataobj.TsdbItem, hash string)
- func StartIndexUpdateIncrTask()
- func StartUpdateIndexTask()
- type DsTypeAndStep
- type IndexAddrs
- type IndexCacheBase
- 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 DeleteItemFronIndex(hash string)
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 (i *IndexCacheBase) ContainsKey(key string) bool
func (*IndexCacheBase) Keys ¶
func (i *IndexCacheBase) Keys() []string
func (*IndexCacheBase) Remove ¶
func (i *IndexCacheBase) Remove(key string)
func (*IndexCacheBase) Size ¶
func (i *IndexCacheBase) Size() int
type IndexCacheItem ¶
索引缓存的元素数据结构
func NewIndexCacheItem ¶
func NewIndexCacheItem(uuid string, 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.