ing
This commit is contained in:
parent
35835eb736
commit
e7a2c3714e
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
cda "git.loafle.net/commons_go/di/annotation"
|
cda "git.loafle.net/commons_go/di/annotation"
|
||||||
cdr "git.loafle.net/commons_go/di/registry"
|
cdr "git.loafle.net/commons_go/di/registry"
|
||||||
|
"git.loafle.net/commons_go/logging"
|
||||||
oocmci "git.loafle.net/overflow/overflow_commons_go/modules/commons/interfaces"
|
oocmci "git.loafle.net/overflow/overflow_commons_go/modules/commons/interfaces"
|
||||||
"git.loafle.net/overflow/overflow_probe_container/crawler"
|
"git.loafle.net/overflow/overflow_probe_container/crawler"
|
||||||
)
|
)
|
||||||
|
@ -47,10 +48,13 @@ func (cs *CrawlerService) GetData(sensorConfigID string) (map[string]string, err
|
||||||
return nil, fmt.Errorf("There is no crawler[%s] for id[%s]", _crawlerName, sensorConfigID)
|
return nil, fmt.Errorf("There is no crawler[%s] for id[%s]", _crawlerName, sensorConfigID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logging.Logger().Debugf("GetData invoked with sensor config[%s]", sensorConfigID)
|
||||||
|
|
||||||
result, err := _crawler.Get(sensorConfig)
|
result, err := _crawler.Get(sensorConfig)
|
||||||
if nil != err {
|
if nil != err {
|
||||||
return nil, fmt.Errorf("Failed to get data from crawler[%s] for id[%s] %v", _crawlerName, sensorConfigID, err)
|
return nil, fmt.Errorf("Failed to get data from crawler[%s] for id[%s] %v", _crawlerName, sensorConfigID, err)
|
||||||
}
|
}
|
||||||
|
logging.Logger().Debugf("GetData success config[%v]", result)
|
||||||
|
|
||||||
return result, nil
|
return result, nil
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
cda "git.loafle.net/commons_go/di/annotation"
|
cda "git.loafle.net/commons_go/di/annotation"
|
||||||
cdr "git.loafle.net/commons_go/di/registry"
|
cdr "git.loafle.net/commons_go/di/registry"
|
||||||
|
"git.loafle.net/commons_go/logging"
|
||||||
oocmci "git.loafle.net/overflow/overflow_commons_go/modules/commons/interfaces"
|
oocmci "git.loafle.net/overflow/overflow_commons_go/modules/commons/interfaces"
|
||||||
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
|
sensorConfigM "git.loafle.net/overflow/overflow_commons_go/modules/sensor_config/model"
|
||||||
)
|
)
|
||||||
|
@ -42,6 +43,8 @@ func (scs *SensorConfigService) Init(sensorConfigs []*sensorConfigM.SensorConfig
|
||||||
scs.sensorConfigs[sensorConfig.ID.String()] = sensorConfig
|
scs.sensorConfigs[sensorConfig.ID.String()] = sensorConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logging.Logger().Debugf("Sensor configs[%d] were added", len(sensorConfigs))
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (scs *SensorConfigService) AddConfig(sensorConfig *sensorConfigM.SensorConfig) error {
|
func (scs *SensorConfigService) AddConfig(sensorConfig *sensorConfigM.SensorConfig) error {
|
||||||
|
@ -54,6 +57,9 @@ func (scs *SensorConfigService) AddConfig(sensorConfig *sensorConfigM.SensorConf
|
||||||
return fmt.Errorf("Sensor config[%s] is exist already", sensorConfigID)
|
return fmt.Errorf("Sensor config[%s] is exist already", sensorConfigID)
|
||||||
}
|
}
|
||||||
scs.sensorConfigs[sensorConfigID] = sensorConfig
|
scs.sensorConfigs[sensorConfigID] = sensorConfig
|
||||||
|
|
||||||
|
logging.Logger().Debugf("Sensor config[%d] was added", sensorConfigID)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (scs *SensorConfigService) UpdateConfig(sensorConfig *sensorConfigM.SensorConfig) error {
|
func (scs *SensorConfigService) UpdateConfig(sensorConfig *sensorConfigM.SensorConfig) error {
|
||||||
|
@ -68,6 +74,8 @@ func (scs *SensorConfigService) UpdateConfig(sensorConfig *sensorConfigM.SensorC
|
||||||
delete(scs.sensorConfigs, sensorConfigID)
|
delete(scs.sensorConfigs, sensorConfigID)
|
||||||
scs.sensorConfigs[sensorConfigID] = sensorConfig
|
scs.sensorConfigs[sensorConfigID] = sensorConfig
|
||||||
|
|
||||||
|
logging.Logger().Debugf("Sensor config[%d] was updated", sensorConfigID)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
func (scs *SensorConfigService) RemoveConfig(sensorConfigID string) error {
|
func (scs *SensorConfigService) RemoveConfig(sensorConfigID string) error {
|
||||||
|
@ -76,5 +84,6 @@ func (scs *SensorConfigService) RemoveConfig(sensorConfigID string) error {
|
||||||
}
|
}
|
||||||
delete(scs.sensorConfigs, sensorConfigID)
|
delete(scs.sensorConfigs, sensorConfigID)
|
||||||
|
|
||||||
|
logging.Logger().Debugf("Sensor config[%d] was removed", sensorConfigID)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user