reassign machines

This commit is contained in:
kepler155c@gmail.com
2018-12-05 12:04:04 -05:00
parent 0041ffaa5e
commit f209719c9d
3 changed files with 127 additions and 19 deletions

View File

@@ -1,5 +1,6 @@
local Adapter = require('miniAdapter')
local class = require('class')
local Config = require('config')
local Event = require('event')
local itemDB = require('itemDB')
local sync = require('sync').sync
@@ -84,6 +85,22 @@ function Storage:initStorage()
end
end
function Storage:saveConfiguration()
local t = { }
for k,v in pairs(self.nodes) do
t[k] = v.adapter
v.adapter = nil
end
-- TODO: Should be named 'storage'
Config.update('milo', self.nodes)
for k,v in pairs(t) do
self.nodes[k].adapter = v
end
self:initStorage()
end
function Storage:getSingleNode(mtype)
local node = Util.find(self.nodes, 'mtype', mtype)
if node and node.adapter and node.adapter.online then