Comparison

mod_storage_gdbm/mod_storage_gdbm.lua @ 1631:98427ed3d53f

mod_storage_gdbm: Update archive metadata only if data write succeeds
author Kim Alvefur <zash@zash.se>
date Wed, 25 Mar 2015 17:41:13 +0100
parent 1630:0fcd63818aa1
child 1632:050d101af207
comparison
equal deleted inserted replaced
1630:0fcd63818aa1 1631:98427ed3d53f
76 if is_stanza(value) then 76 if is_stanza(value) then
77 type, value = "stanza", st.preserialize(value); 77 type, value = "stanza", st.preserialize(value);
78 end 78 end
79 meta[i] = { key = key, when = when, with = with, type = type }; 79 meta[i] = { key = key, when = when, with = with, type = type };
80 meta[key] = i; 80 meta[key] = i;
81 local ok, err = self:set(username, meta); 81 local ok, err = self:set(key, value);
82 if not ok then return nil, err; end 82 if not ok then return nil, err; end
83 ok, err = self:set(key, value); 83 ok, err = self:set(username, meta);
84 if not ok then return nil, err; end 84 if not ok then return nil, err; end
85 return key; 85 return key;
86 end 86 end
87 87
88 local deserialize = { 88 local deserialize = {