Mercurial > prosody-modules
comparison mod_storage_gdbm/mod_storage_gdbm.lua @ 1633:1d2dc6c74581
mod_storage_gdbm: Add user iterator
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Wed, 25 Mar 2015 17:45:17 +0100 |
parents | 050d101af207 |
children | 25441bd8b344 |
comparison
equal
deleted
inserted
replaced
1632:050d101af207 | 1633:1d2dc6c74581 |
---|---|
55 | 55 |
56 function keyval:get(user) | 56 function keyval:get(user) |
57 local data, err = g_get(self._db, user or "@"); | 57 local data, err = g_get(self._db, user or "@"); |
58 if not data then return nil, err; end | 58 if not data then return nil, err; end |
59 return deserialize(data); | 59 return deserialize(data); |
60 end | |
61 | |
62 local function g_keys(db, key) | |
63 return (key == nil and g_first or g_next)(db, key); | |
64 end | |
65 | |
66 function keyval:users() | |
67 return g_keys, self._db, nil; | |
60 end | 68 end |
61 | 69 |
62 local archive = {}; | 70 local archive = {}; |
63 local archive_mt = { __index = archive, suffix = ".adb" }; | 71 local archive_mt = { __index = archive, suffix = ".adb" }; |
64 | 72 |