Software /
code /
prosody
Comparison
plugins/mod_storage_internal.lua @ 5153:688aeac0012a
mod_storage_internal, datamanager: Add support for iterating over users with data in a store
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Fri, 21 Sep 2012 17:23:08 +0200 |
parent | 5133:1443d1c37c6c |
child | 6283:7cf6d3a2c855 |
comparison
equal
deleted
inserted
replaced
5152:fee5f8d4ec74 | 5153:688aeac0012a |
---|---|
3 local host = module.host; | 3 local host = module.host; |
4 | 4 |
5 local driver = {}; | 5 local driver = {}; |
6 local driver_mt = { __index = driver }; | 6 local driver_mt = { __index = driver }; |
7 | 7 |
8 function driver:open(store) | 8 function driver:open(store, typ) |
9 return setmetatable({ store = store }, driver_mt); | 9 return setmetatable({ store = store, type = typ }, driver_mt); |
10 end | 10 end |
11 function driver:get(user) | 11 function driver:get(user) |
12 return datamanager.load(user, host, self.store); | 12 return datamanager.load(user, host, self.store); |
13 end | 13 end |
14 | 14 |
18 | 18 |
19 function driver:stores(username) | 19 function driver:stores(username) |
20 return datamanager.stores(username, host); | 20 return datamanager.stores(username, host); |
21 end | 21 end |
22 | 22 |
23 function driver:users() | |
24 return datamanager.users(host, self.store, self.type); | |
25 end | |
26 | |
23 function driver:purge(user) | 27 function driver:purge(user) |
24 return datamanager.purge(user, host); | 28 return datamanager.purge(user, host); |
25 end | 29 end |
26 | 30 |
27 module:provides("storage", driver); | 31 module:provides("storage", driver); |