Software /
code /
prosody
Comparison
plugins/mod_storage_memory.lua @ 9905:6d50efaee148
mod_storage_memory: Implement archive summary API
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 23 Mar 2019 22:05:08 +0100 |
parent | 9887:69f810014853 |
child | 9906:d0b58bdd6c86 |
comparison
equal
deleted
inserted
replaced
9904:bf061f5512f7 | 9905:6d50efaee148 |
---|---|
143 i = i + 1; | 143 i = i + 1; |
144 local item = items[i]; | 144 local item = items[i]; |
145 if not item then return; end | 145 if not item then return; end |
146 return item.key, item.value(), item.when, item.with; | 146 return item.key, item.value(), item.when, item.with; |
147 end, count; | 147 end, count; |
148 end | |
149 | |
150 function archive:summary(username, query) | |
151 local iter, err = self:find(username, query) | |
152 if not iter then return iter, err; end | |
153 local summary = {}; | |
154 for _, _, _, with in iter do | |
155 summary[with] = (summary[with] or 0) + 1; | |
156 end | |
157 return summary; | |
148 end | 158 end |
149 | 159 |
150 | 160 |
151 function archive_store:delete(username, query) | 161 function archive_store:delete(username, query) |
152 if not query or next(query) == nil then | 162 if not query or next(query) == nil then |