var orchClientId int32
var orcheClients = [1024]orcheClient{}
-func Init(settingPath string) {
+func Init(settingPath string) *Orche {
orcheEngine = new(Orche)
- return
+ return orcheEngine
}
atomic.AddInt32(&orchClientId, 1)
serviceClient := addServiceClient(clientId, libName, serviceName, args)
- serviceClient.listenNotify()
+ go serviceClient.listenNotify()
endpoints := getEndpointDevices(serviceName)
deviceScores := sortByScore(gatheringDevicesScore(endpoints, libName))
executeApp(deviceScores[0].endpoint, serviceName, args, serviceClient.notiChan)
-
-
ILog.Println(deviceScores)
return
}
func gatheringDevicesScore(endpoints []string, libName string) (deviceScores []deviceScore){
for _ , endpoint := range endpoints {
- score := orcheEngine.IScoringmgr.IGetScore(endpoint, libName)
+
+ //(chacha)TODO : err occured , notify devicemgr to delete
+ score, _ := orcheEngine.IScoringmgr.IGetScore(endpoint, libName)
+
deviceScores = append(deviceScores, deviceScore{endpoint, score})
}