summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-03-24 23:16:21 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-03-25 09:03:09 +0200
commit8a024c20ca7820499722a792e775b4f33fdf7dec (patch)
tree33bfc7aad4ec91c2519dd2ea448f8c96bfca67c5
parent0490dce7900c65fd22daca163356c499fc527c42 (diff)
downloadaconf-8a024c20ca7820499722a792e775b4f33fdf7dec.tar.bz2
aconf-8a024c20ca7820499722a792e775b4f33fdf7dec.tar.xz
persistence: return zero timestamp when fetching from null backend
-rw-r--r--aconf/persistence/backends/null.lua2
-rw-r--r--aconf/persistence/init.lua4
2 files changed, 3 insertions, 3 deletions
diff --git a/aconf/persistence/backends/null.lua b/aconf/persistence/backends/null.lua
index 770e5e8..5210c92 100644
--- a/aconf/persistence/backends/null.lua
+++ b/aconf/persistence/backends/null.lua
@@ -4,7 +4,7 @@ See LICENSE file for license details
--]]
local backend = require('aconf.object').class()
-function backend:get(path, top) if #path == 0 then return {} end end
+function backend:get(path, top) return #path == 0 and {} or nil, 0 end
function backend:set(mods) end
return backend
diff --git a/aconf/persistence/init.lua b/aconf/persistence/init.lua
index c1398fa..bcc1f0e 100644
--- a/aconf/persistence/init.lua
+++ b/aconf/persistence/init.lua
@@ -45,7 +45,7 @@ function DataStore:get(path)
local backend, comps = self:split_path(path)
local top = topology(path)
- local value = backend:get(comps, top)
+ local value, ts = backend:get(comps, top)
if top then
local t = top.type
@@ -80,7 +80,7 @@ function DataStore:get(path)
end
end
- return util.copy(value), self.mod_time[path] or 0
+ return util.copy(value), ts or self.mod_time[path] or 0
end
function DataStore:_set_multiple(mods)