summaryrefslogtreecommitdiffstats
path: root/aconf/transaction/base.lua
diff options
context:
space:
mode:
Diffstat (limited to 'aconf/transaction/base.lua')
-rw-r--r--aconf/transaction/base.lua22
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