Beispiel #1
0
func NewSearch(data database.DataAccess) *Search {
	s := Search{
		DataAccess: data,
		Last:       make(map[string]*lastInfo),
		indexQueue: make(chan *opentsdb.DataPoint, 300000),
	}
	collect.Set("search.index_queue", opentsdb.TagSet{}, func() interface{} { return len(s.indexQueue) })
	go s.redisIndex(s.indexQueue)
	return &s
}
Beispiel #2
0
func NewSearch(data database.DataAccess, skipLast bool) *Search {
	s := Search{
		DataAccess: data,
		last:       make(map[string]map[string]*database.LastInfo),
		indexQueue: make(chan *opentsdb.DataPoint, 300000),
	}
	collect.Set("search.index_queue", opentsdb.TagSet{}, func() interface{} { return len(s.indexQueue) })
	if !skipLast {
		s.loadLast()
		go s.redisIndex(s.indexQueue)
		go s.backupLoop()
	}
	return &s
}