# HG changeset patch # User Kim Alvefur # Date 1553375108 -3600 # Node ID 6d50efaee148293e9266dfc926574f7d4087fd19 # Parent bf061f5512f7452760dd0d6a165e354c207de9a0 mod_storage_memory: Implement archive summary API diff -r bf061f5512f7 -r 6d50efaee148 plugins/mod_storage_memory.lua --- a/plugins/mod_storage_memory.lua Mon Feb 25 15:51:55 2019 +0100 +++ b/plugins/mod_storage_memory.lua Sat Mar 23 22:05:08 2019 +0100 @@ -147,6 +147,16 @@ end, count; end +function archive:summary(username, query) + local iter, err = self:find(username, query) + if not iter then return iter, err; end + local summary = {}; + for _, _, _, with in iter do + summary[with] = (summary[with] or 0) + 1; + end + return summary; +end + function archive_store:delete(username, query) if not query or next(query) == nil then