collector

This commit is contained in:
insanity@loafle.com 2017-05-16 16:44:02 +09:00
parent 58c6c696ad
commit f205c2e550

View File

@ -42,8 +42,6 @@ func GetInstance() *Collector {
return instance return instance
} }
func (c *Collector) start(started chan bool, conf cm.ConfigManager) { func (c *Collector) start(started chan bool, conf cm.ConfigManager) {
go func() { go func() {
c.cm = conf c.cm = conf
@ -59,7 +57,6 @@ func (c *Collector) start(started chan bool, conf cm.ConfigManager) {
}() }()
} }
func (c *Collector) stop() { func (c *Collector) stop() {
c.scheduler.RemoveAllSchedule() c.scheduler.RemoveAllSchedule()
c.scheduler.Stop() c.scheduler.Stop()
@ -107,8 +104,12 @@ func (c *Collector) removeSensor(id string) error {
return nil return nil
} }
func (c *Collector) updateSensor(id string) { func (c *Collector) updateSensor(id string) error {
//update err := c.removeSensor(id)
if err != nil {
return err
}
return c.addSensor(id)
} }
func AddSensor(id string) error { func AddSensor(id string) error {
@ -119,6 +120,10 @@ func RemSensor(id string) error {
return GetInstance().removeSensor(id) return GetInstance().removeSensor(id)
} }
func UpdateSensor(id string) error {
return GetInstance().updateSensor(id)
}
func StartSensor(id string) error { func StartSensor(id string) error {
return GetInstance().scheduler.StartSchedule(id) return GetInstance().scheduler.StartSchedule(id)
} }