diff options
author | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-03-11 13:59:25 +0200 |
---|---|---|
committer | Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> | 2015-03-11 16:54:31 +0200 |
commit | 83889bc5e4659e845d919e9a477a29167e7cb4f8 (patch) | |
tree | 8e9c748d75c4f5a090f92329dad28f3df3654447 /aconf/transaction/base.lua | |
parent | 9843bb8363978b1556d3ccc79bd4c08027af7bfe (diff) | |
download | aconf-83889bc5e4659e845d919e9a477a29167e7cb4f8.tar.bz2 aconf-83889bc5e4659e845d919e9a477a29167e7cb4f8.tar.xz |
remove address module
Diffstat (limited to 'aconf/transaction/base.lua')
-rw-r--r-- | aconf/transaction/base.lua | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/aconf/transaction/base.lua b/aconf/transaction/base.lua index cda7ed6..6522d81 100644 --- a/aconf/transaction/base.lua +++ b/aconf/transaction/base.lua @@ -10,7 +10,7 @@ local err = require('aconf.error') local object = require('aconf.object') local class = object.class -local address = require('aconf.path.address') +local pth = require('aconf.path') local util = require('aconf.util') -- TODO each transaction backend (i.e. persistence manager or @@ -116,21 +116,21 @@ end function M.Transaction:expand(path) local prefix = {} - path = address.split(path) + path = pth.split(path) while path[1] do local comp = path[1] table.remove(path, 1) - if comp == address.wildcard then - local p = address.join('/', table.unpack(prefix)) + if comp == pth.wildcard then + local p = pth.join('/', table.unpack(prefix)) local res = {} local children = self:get(p) or {} table.sort(children) for _, child in ipairs(children) do util.extend( - res, self:expand(address.join(p, child, table.unpack(path))) + res, self:expand(pth.join(p, child, table.unpack(path))) ) end @@ -140,7 +140,7 @@ function M.Transaction:expand(path) table.insert(prefix, comp) end - return {address.join('/', table.unpack(prefix))} + return {pth.join('/', table.unpack(prefix))} end function M.Transaction:_set_multiple(mods) @@ -157,14 +157,14 @@ function M.Transaction:_set_multiple(mods) for _, mod in ipairs(mods) do local path, value = table.unpack(mod) - local ppath = address.parent(path) + local ppath = pth.parent(path) local parent = self:get(ppath) if parent == nil then parent = {} self:set(ppath, parent) end - local name = address.name(path) + local name = pth.name(path) local old = self:get(path) local is_table = type(value) == 'table' @@ -175,7 +175,7 @@ function M.Transaction:_set_multiple(mods) if type(old) == 'table' then if delete then for _, child in ipairs(old) do - self:set(address.join(path, child)) + self:set(pth.join(path, child)) end elseif is_table then return elseif #old > 0 then @@ -215,7 +215,7 @@ function M.Transaction:commit() local function insert_add(path) if not handled[path] then - local pp = address.parent(path) + local pp = pth.parent(path) if self.added[pp] then insert_add(pp) end insert(path, self.added[path]) end @@ -226,7 +226,7 @@ function M.Transaction:commit() local value = self.backend:get(path) if type(value) == 'table' then for _, child in ipairs(value) do - local cp = address.join(path, child) + local cp = pth.join(path, child) assert(self.deleted[cp]) insert_del(cp) end |