73 lines
1.9 KiB
Go
73 lines
1.9 KiB
Go
package service
|
|
|
|
// "context"
|
|
// "time"
|
|
|
|
// "git.loafle.net/commons_go/logging"
|
|
// oocmci "git.loafle.net/overflow/overflow_commons_go/modules/commons/interfaces"
|
|
|
|
func InitService() {
|
|
}
|
|
|
|
func StartService(services []interface{}) {
|
|
// 1. Sensor config
|
|
// 2. Container
|
|
// 3. Collector
|
|
|
|
// if nil != services && 0 < len(services) {
|
|
// for _, service := range services {
|
|
// if err := service.(oocmci.Service).Start(); err != nil {
|
|
// logging.Logger().Errorf("Probe: Cannot start service %v", err)
|
|
// }
|
|
// }
|
|
// }
|
|
}
|
|
|
|
func StopService(services []interface{}) {
|
|
// if nil != services && 0 < len(services) {
|
|
// for _, service := range services {
|
|
// ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
|
// defer cancel()
|
|
// if err := service.(oocmci.Service).Stop(ctx); err != nil {
|
|
// logging.Logger().Errorf("Probe: Cannot start service %v", err)
|
|
// }
|
|
// }
|
|
// }
|
|
}
|
|
|
|
func DestroyService() {
|
|
|
|
}
|
|
|
|
// func GetService(name string) interface{} {
|
|
// var t reflect.Type
|
|
// switch name {
|
|
// case "CentralService":
|
|
// t = reflect.TypeOf((*CentralService)(nil))
|
|
// case "ConfigService":
|
|
// t = reflect.TypeOf((*ConfigService)(nil))
|
|
// case "ContainerService":
|
|
// t = reflect.TypeOf((*ContainerService)(nil))
|
|
// case "CrawlerService":
|
|
// t = reflect.TypeOf((*CrawlerService)(nil))
|
|
// case "DiscoveryService":
|
|
// t = reflect.TypeOf((*DiscoveryService)(nil))
|
|
// case "LogService":
|
|
// t = reflect.TypeOf((*LogService)(nil))
|
|
// case "ProbeService":
|
|
// t = reflect.TypeOf((*ProbeService)(nil))
|
|
// case "SensorService":
|
|
// t = reflect.TypeOf((*SensorService)(nil))
|
|
// default:
|
|
// logging.Logger().Panicf("Probe: Service[%s] is not exist", name)
|
|
// return nil
|
|
// }
|
|
|
|
// i, err := cdr.GetInstance(t)
|
|
// if nil != err {
|
|
// logging.Logger().Panicf("Probe: Getting Service[%s] is failed %v", name, err)
|
|
// return nil
|
|
// }
|
|
// return i
|
|
// }
|