Changeset

13144:033ea8b46d6a

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.
author Kim Alvefur <zash@zash.se>
date Sat, 10 Jun 2023 16:39:48 +0200
parents 13143:3ec48555b773
children 13145:af251471d5ae
files plugins/mod_storage_sql.lua
diffstat 1 files changed, 17 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_storage_sql.lua	Sat Jun 10 15:44:09 2023 +0200
+++ b/plugins/mod_storage_sql.lua	Sat Jun 10 16:39:48 2023 +0200
@@ -660,10 +660,27 @@
 	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