From 83889bc5e4659e845d919e9a477a29167e7cb4f8 Mon Sep 17 00:00:00 2001 From: Kaarle Ritvanen Date: Wed, 11 Mar 2015 13:59:25 +0200 Subject: remove address module --- aconf/persistence/backends/augeas.lua | 12 ++++++------ aconf/persistence/backends/files.lua | 5 ++--- aconf/persistence/backends/json.lua | 6 +++--- aconf/persistence/defer.lua | 4 ++-- aconf/persistence/init.lua | 6 +++--- 5 files changed, 16 insertions(+), 17 deletions(-) (limited to 'aconf/persistence') diff --git a/aconf/persistence/backends/augeas.lua b/aconf/persistence/backends/augeas.lua index 46d3ea9..7ce68f0 100644 --- a/aconf/persistence/backends/augeas.lua +++ b/aconf/persistence/backends/augeas.lua @@ -5,7 +5,7 @@ See LICENSE file for license details local topology = require('aconf.model.root').topology local class = require('aconf.object').class -local address = require('aconf.path.address') +local pth = require('aconf.path') local tostr = require('aconf.persistence.util').tostring local util = require('aconf.util') @@ -92,7 +92,7 @@ local function conv_path(path) keys = {} end - top = top and top(address.escape(comp)) + top = top and top(pth.escape(comp)) mode = top and top.mode table.remove(path, 1) @@ -194,7 +194,7 @@ function backend:set(mods) local ppath, pmode = conv_path(parent) if is_selector(pmode) then - gc[address.join('/', table.unpack(parent))] = false + gc[pth.join('/', table.unpack(parent))] = false if pmode == 'enumerate' then local count = #self.aug:match(ppath) @@ -259,11 +259,11 @@ function backend:set(mods) self.aug:set(apath, value ~= nil and tostr(value) or nil) end - util.setdefault(gc, address.join('/', table.unpack(path)), true) + util.setdefault(gc, pth.join('/', table.unpack(path)), true) end for path, _ in pairs(gc) do - local p = address.split(path) + local p = pth.split(path) while #p > 0 do local value = self:get(p) @@ -275,7 +275,7 @@ function backend:set(mods) break end - if gc[address.join('/', table.unpack(p))] ~= false then + if gc[pth.join('/', table.unpack(p))] ~= false then self.aug:rm(conv_path(p)) end p[#p] = nil diff --git a/aconf/persistence/backends/files.lua b/aconf/persistence/backends/files.lua index c619754..bfb3d49 100644 --- a/aconf/persistence/backends/files.lua +++ b/aconf/persistence/backends/files.lua @@ -5,7 +5,6 @@ See LICENSE file for license details local topology = require('aconf.model.root').topology local pth = require('aconf.path') -local address = require('aconf.path.address') local util = require('aconf.persistence.util') local posix = require('posix') @@ -29,7 +28,7 @@ local backend = require('aconf.object').class() function backend:init() self.cache = {} end function backend:get(path, top) - local name = address.join('/', table.unpack(path)) + local name = pth.join('/', table.unpack(path)) if not self.cache[name] then local t = posix.stat(name, 'type') @@ -69,7 +68,7 @@ end function backend:set(mods) for _, mod in pairs(mods) do local path, value = table.unpack(mod) - local name = address.join('/', table.unpack(path)) + local name = pth.join('/', table.unpack(path)) if value == nil then print('DEL', name) diff --git a/aconf/persistence/backends/json.lua b/aconf/persistence/backends/json.lua index 5a13955..66cb667 100644 --- a/aconf/persistence/backends/json.lua +++ b/aconf/persistence/backends/json.lua @@ -3,7 +3,7 @@ Copyright (c) 2012-2015 Kaarle Ritvanen See LICENSE file for license details --]] -local address = require('aconf.path.address') +local pth = require('aconf.path') local Cache = require('aconf.persistence.backends.volatile') local util = require('aconf.persistence.util') local copy = require('aconf.util').copy @@ -26,7 +26,7 @@ function backend:split_path(path) local res while #fpath > 0 do - local fp = address.join('/', table.unpack(fpath)) + local fp = pth.join('/', table.unpack(fpath)) if self.cache[fp] then return fp, jpath end table.insert(jpath, 1, fpath[#fpath]) table.remove(fpath) @@ -35,7 +35,7 @@ function backend:split_path(path) fpath = '/' while true do - fpath = address.join(fpath, jpath[1]) + fpath = pth.join(fpath, jpath[1]) table.remove(jpath, 1) local t = posix.stat(fpath, 'type') diff --git a/aconf/persistence/defer.lua b/aconf/persistence/defer.lua index d7f33d8..fa10805 100644 --- a/aconf/persistence/defer.lua +++ b/aconf/persistence/defer.lua @@ -6,7 +6,7 @@ See LICENSE file for license details local object = require('aconf.object') local super = object.super -local address = require('aconf.path.address') +local pth = require('aconf.path') local DeferringCommitter = object.class( @@ -31,7 +31,7 @@ function DeferringCommitter:_set_multiple(mods) local path, value = table.unpack(mod) while path > '/' do if self.defer_paths[path] then return end - path = address.parent(path) + path = pth.parent(path) end end diff --git a/aconf/persistence/init.lua b/aconf/persistence/init.lua index 632c191..481e859 100644 --- a/aconf/persistence/init.lua +++ b/aconf/persistence/init.lua @@ -6,7 +6,7 @@ See LICENSE file for license details local loadmods = require('aconf.loader') local topology = require('aconf.model.root').topology local object = require('aconf.object') -local address = require('aconf.path.address') +local pth = require('aconf.path') local util = require('aconf.util') local contains = util.contains @@ -38,7 +38,7 @@ function DataStore:trigger(phase, path, func) end function DataStore:split_path(path) - local comps = address.split(path) + local comps = pth.split(path) local backend = self.backends[comps[1]] assert(backend) table.remove(comps, 1) @@ -105,7 +105,7 @@ function DataStore:_set_multiple(mods) local tp = path while not trigger[tp] do trigger[tp] = true - tp = address.parent(tp) + tp = pth.parent(tp) end local backend, comps = self:split_path(path) -- cgit v1.2.3