Developing lightweight computation at the DSG edge

Commit 3b6a533d authored by Roger Pueyo Centelles's avatar Roger Pueyo Centelles
Browse files

[monitor-assign] Switch to the native Antidote Go client


Signed-off-by: Roger Pueyo Centelles's avatarRoger Pueyo Centelles <rpueyo@ac.upc.edu>
parent 576838c0
......@@ -12,8 +12,8 @@ import (
"strconv"
"time"
"uc-monitor-go-test/apidote"
"uc-monitor-go-test/cnml"
"uc-monitor-go-test/goclidote"
"github.com/golang/glog"
)
......@@ -190,7 +190,7 @@ func readDevsaddsFile(filename string, errLevel int) []cnml.DeviceIpv4sGraphserv
// Get the global devices list from AntidoteDB
func getCnmlDevicesList() []cnml.DeviceIpv4sGraphserver {
return apidote.ReadDevicesFromAntidote()
return goclidote.ReadDevicesFromAntidote()
}
//Import all the monitor=>device assignations
......@@ -198,11 +198,11 @@ func updateGlobalAssignationList() {
for _, v := range cnmlDevices {
if isDeviceInAssignationSlice(v.ID, globalAssign) {
globalAssign[posDeviceInAssignationSlice(v.ID, globalAssign)].MonitorID = apidote.AntidoteReadItemsFromSetInBucket(fmt.Sprintf("device-%d", v.ID), "monitors")
globalAssign[posDeviceInAssignationSlice(v.ID, globalAssign)].MonitorID = goclidote.AntidoteReadItemsFromSetInBucket(fmt.Sprintf("device-%d", v.ID), "monitors")
} else {
var newDev cnml.DeviceMonitorAssignation
newDev.DeviceID = v.ID
newDev.MonitorID = apidote.AntidoteReadItemsFromSetInBucket(fmt.Sprintf("device-%d", v.ID), "monitors")
newDev.MonitorID = goclidote.AntidoteReadItemsFromSetInBucket(fmt.Sprintf("device-%d", v.ID), "monitors")
globalAssign = append(globalAssign, newDev)
}
}
......@@ -301,7 +301,7 @@ func reassignDevs() {
if assgnchanges {
fmt.Println("Exporting the new assigned devices list")
for _, v := range localAssign {
apidote.AntidoteAddItemToSetInBucket(fmt.Sprintf("device-%d", v.DeviceID), "monitors", ID)
goclidote.AntidoteAddItemToSetInBucket(fmt.Sprintf("device-%d", v.DeviceID), "monitors", ID)
}
}
}
......@@ -326,7 +326,7 @@ func reassignDevs() {
// if assgnchanges {
// localAssign = newlocalAssign
// for _, v := range deldevs {
// apidote.AntidoteRemoveItemFromSetInBucket(fmt.Sprintf("device-%d", v.ID), "monitors", ID)
// goclidote.AntidoteRemoveItemFromSetInBucket(fmt.Sprintf("device-%d", v.ID), "monitors", ID)
// }
// }
// }
......@@ -466,11 +466,11 @@ func startLocalAssignTimer() {
}
func registerMonitorInAntidote() {
apidote.AntidoteAddItemToSetInBucket("guifi", "monitors", ID)
goclidote.AntidoteAddItemToSetInBucket("guifi", "monitors", ID)
}
func deregisterMonitorInAntidote() {
apidote.AntidoteRemoveItemFromSetInBucket("guifi", "monitors", ID)
goclidote.AntidoteRemoveItemFromSetInBucket("guifi", "monitors", ID)
}
func errCheck(e error, level int, message string) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment