Software /
code /
prosody
Comparison
plugins/mod_storage_sql.lua @ 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 |
parent | 13143:3ec48555b773 |
child | 13148:c6f46f33cecf |
comparison
equal
deleted
inserted
replaced
13143:3ec48555b773 | 13144:033ea8b46d6a |
---|---|
658 end); | 658 end); |
659 if not ok then error(result); end | 659 if not ok then error(result); end |
660 return iterator(result); | 660 return iterator(result); |
661 end | 661 end |
662 | 662 |
663 local keyvalplus = { | |
664 __index = { | |
665 -- keyval | |
666 get = keyval_store.get; | |
667 set = keyval_store.set; | |
668 items = keyval_store.users; | |
669 -- map | |
670 get_key = map_store.get; | |
671 set_key = map_store.set; | |
672 remove = map_store.remove; | |
673 set_keys = map_store.set_keys; | |
674 get_key_from_all = map_store.get_all; | |
675 delete_key_from_all = map_store.delete_all; | |
676 }; | |
677 } | |
678 | |
663 local stores = { | 679 local stores = { |
664 keyval = keyval_store; | 680 keyval = keyval_store; |
665 map = map_store; | 681 map = map_store; |
666 archive = archive_store; | 682 archive = archive_store; |
683 ["keyval+"] = keyvalplus; | |
667 }; | 684 }; |
668 | 685 |
669 --- Implement storage driver API | 686 --- Implement storage driver API |
670 | 687 |
671 -- FIXME: Some of these operations need to operate on the archive store(s) too | 688 -- FIXME: Some of these operations need to operate on the archive store(s) too |