Comparison

plugins/mod_pubsub/mod_pubsub.lua @ 9108:86f31a2174b3

mod_pubsub: Add comment to document nodestore/itemstore methods
author Matthew Wild <mwild1@gmail.com>
date Sat, 04 Aug 2018 21:33:17 +0100
parent 9101:1ff694534e98
child 9118:70f34c663fb3
comparison
equal deleted inserted replaced
9107:6e42ef9c805c 9108:86f31a2174b3
22 module:add_feature("http://jabber.org/protocol/pubsub"); 22 module:add_feature("http://jabber.org/protocol/pubsub");
23 23
24 function handle_pubsub_iq(event) 24 function handle_pubsub_iq(event)
25 return lib_pubsub.handle_pubsub_iq(event, service); 25 return lib_pubsub.handle_pubsub_iq(event, service);
26 end 26 end
27
28 -- An itemstore supports the following methods:
29 -- items(): iterator over (id, item)
30 -- get(id): return item with id
31 -- set(id, item): set id to item
32 -- clear(): clear all items
33 -- resize(n): set new limit and trim oldest items
34 -- tail(): return the latest item
35
36 -- A nodestore supports the following methods:
37 -- set(node_name, node_data)
38 -- get(node_name)
39 -- users(): iterator over (node_name)
40
27 41
28 local node_store = module:open_store(module.name.."_nodes"); 42 local node_store = module:open_store(module.name.."_nodes");
29 43
30 local function create_simple_itemstore(node_config, node_name) 44 local function create_simple_itemstore(node_config, node_name)
31 local archive = module:open_store("pubsub_"..node_name, "archive"); 45 local archive = module:open_store("pubsub_"..node_name, "archive");