52 node_obj.data[id] = item; |
52 node_obj.data[id] = item; |
53 self.cb.broadcaster(node, node_obj.subscribers, item); |
53 self.cb.broadcaster(node, node_obj.subscribers, item); |
54 return true; |
54 return true; |
55 end |
55 end |
56 |
56 |
|
57 function service:retract(node, actor, id, retract) |
|
58 local node_obj = self.nodes[node]; |
|
59 if (not node_obj) or (not node_obj.data[id]) then |
|
60 return false, "item-not-found"; |
|
61 end |
|
62 node_obj.data[id] = nil; |
|
63 if retract then |
|
64 self.cb.broadcaster(node, node_obj.subscribers, retract); |
|
65 end |
|
66 return true |
|
67 end |
|
68 |
57 function service:get(node, actor, id) |
69 function service:get(node, actor, id) |
58 local node_obj = self.nodes[node]; |
70 local node_obj = self.nodes[node]; |
59 if node_obj then |
71 if node_obj then |
60 if id then |
72 if id then |
61 return { node_obj.data[id] }; |
73 return { node_obj.data[id] }; |