2018-05-04 21:39:57 +00:00
|
|
|
local util = require("util")
|
|
|
|
|
|
|
|
local _M = {}
|
|
|
|
|
2018-05-18 21:36:43 +00:00
|
|
|
function _M.new(self, o)
|
|
|
|
o = o or {}
|
|
|
|
setmetatable(o, self)
|
|
|
|
self.__index = self
|
|
|
|
return o
|
2018-05-09 15:26:04 +00:00
|
|
|
end
|
|
|
|
|
2018-05-18 21:36:43 +00:00
|
|
|
function _M.sync(self, backend)
|
|
|
|
local nodes = util.get_nodes(backend.endpoints)
|
|
|
|
local changed = not util.deep_compare(self.instance.nodes, nodes)
|
|
|
|
if not changed then
|
|
|
|
return
|
2018-05-04 21:39:57 +00:00
|
|
|
end
|
|
|
|
|
2018-05-18 21:36:43 +00:00
|
|
|
self.instance:reinit(nodes)
|
2018-05-04 21:39:57 +00:00
|
|
|
end
|
|
|
|
|
2018-05-18 21:36:43 +00:00
|
|
|
function _M.after_balance(_)
|
2018-05-09 15:26:04 +00:00
|
|
|
end
|
|
|
|
|
2018-05-04 21:39:57 +00:00
|
|
|
return _M
|