Software /
code /
prosody
Changeset
11277:1256f32f21b6
mod_storage_memory: Support query for set of IDs
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Tue, 12 Jan 2021 18:06:33 +0100 |
parents | 11276:7b2ee8995af9 |
children | 11278:c3907f05bed4 |
files | plugins/mod_storage_memory.lua |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/mod_storage_memory.lua Tue Jan 12 18:03:40 2021 +0100 +++ b/plugins/mod_storage_memory.lua Tue Jan 12 18:06:33 2021 +0100 @@ -4,6 +4,7 @@ local st = require "util.stanza"; local is_stanza = st.is_stanza or function (s) return getmetatable(s) == st.stanza_mt end local new_id = require "util.id".medium; +local set = require "util.set"; local auto_purge_enabled = module:get_option_boolean("storage_memory_temporary", false); local auto_purge_stores = module:get_option_set("storage_memory_temporary_stores", {}); @@ -58,6 +59,7 @@ quota = archive_item_limit; truncate = true; full_id_range = true; + ids = true; }; function archive_store:append(username, key, value, when, with) @@ -110,6 +112,12 @@ return item.key == query.key; end); end + if query.ids then + local ids = set.new(query.ids); + items:filter(function (item) + return ids:contains(item.key); + end); + end if query.with then items:filter(function (item) return item.with == query.with;