15
def generic_handler(ts, key, data):
17
Generic handler to broadcast message to all peers, custom handlers
18
can be created by func name handler_<event_name>
19
Ex: handle_event_volume_create(ts, key, data)
21
utils.publish(ts, key, data)
24
def handle_event_volume_set(ts, key, data):
26
Received data will have all the options as one string, split into
27
list of options. "key1,value1,key2,value2" into
28
[[key1, value1], [key2, value2]]
30
opts = data.get("options", "").strip(",").split(",")
32
for i, opt in enumerate(opts):
35
data["options"].append([opt])
38
data["options"][-1].append(opt)
40
utils.publish(ts, key, data)