diff options
author | jaehoon.hyun <jaehoon.hyun@samsung.com> | 2019-04-02 19:09:45 +0900 |
---|---|---|
committer | jaehoon.hyun <jaehoon.hyun@samsung.com> | 2019-04-02 19:09:45 +0900 |
commit | a36fdca99dc8900d006c38f3394e209add8355b7 (patch) | |
tree | 850c68c713a62c6c607724e92b2bd6048f0210ad | |
parent | 89d869b129b94bf5d844ed75415d287d8eeed709 (diff) | |
download | edge-orchestration-a36fdca99dc8900d006c38f3394e209add8355b7.tar.gz edge-orchestration-a36fdca99dc8900d006c38f3394e209add8355b7.tar.bz2 edge-orchestration-a36fdca99dc8900d006c38f3394e209add8355b7.zip |
orchEngine it is global variable initialize when Init function called.
serviceClient.listenNotify operate goroutine
-rw-r--r-- | src/orchestrationapi/orchstration_api.go | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/orchestrationapi/orchstration_api.go b/src/orchestrationapi/orchstration_api.go index 901226f..d3ff5d7 100644 --- a/src/orchestrationapi/orchstration_api.go +++ b/src/orchestrationapi/orchstration_api.go @@ -52,11 +52,11 @@ type orcheClient struct { var orchClientId int32 var orcheClients = [1024]orcheClient{} -func Init(settingPath string) { +func Init(settingPath string) *Orche { orcheEngine = new(Orche) - return + return orcheEngine } @@ -67,13 +67,11 @@ func RequestService(libName string, serviceName string, args []string) (handle i 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 } @@ -108,7 +106,10 @@ func getEndpointDevices(serviceName string) []string{ 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}) } |