diff options
author | Kim Alvefur <zash@zash.se> | 2023-06-10 16:39:48 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2023-06-10 16:39:48 +0200 |
commit | 1ece33405d78fe38c9adae66cb8aca1d325a40a7 (patch) | |
tree | 1652ca00da357da2802178d5cf76921fabb44108 /plugins | |
parent | 77e0a63ab10bfe69b8e71ceed309e9443ebf94b8 (diff) | |
download | prosody-1ece33405d78fe38c9adae66cb8aca1d325a40a7.tar.gz prosody-1ece33405d78fe38c9adae66cb8aca1d325a40a7.zip |
mod_storage_sql: Compose a keyval+ store out of keyval and map store methods
Removes the need for the shim in storagemanager.
The methods only really access the 'store' property of the first (self)
argument, so this is safe.
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/mod_storage_sql.lua | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/plugins/mod_storage_sql.lua b/plugins/mod_storage_sql.lua index 608041cc..4b38e9fe 100644 --- a/plugins/mod_storage_sql.lua +++ b/plugins/mod_storage_sql.lua @@ -660,10 +660,27 @@ function archive_store:users() return iterator(result); end +local keyvalplus = { + __index = { + -- keyval + get = keyval_store.get; + set = keyval_store.set; + items = keyval_store.users; + -- map + get_key = map_store.get; + set_key = map_store.set; + remove = map_store.remove; + set_keys = map_store.set_keys; + get_key_from_all = map_store.get_all; + delete_key_from_all = map_store.delete_all; + }; +} + local stores = { keyval = keyval_store; map = map_store; archive = archive_store; + ["keyval+"] = keyvalplus; }; --- Implement storage driver API |