Open sphaero opened 9 years ago
Note that there is an ongoing discussion about consistency in arguments between some of the onpeer* methods: https://github.com/z25/pyZOCP/pull/34
I am not dead-set on emit_signal
as a method name. What it actually does (currently) is that it updates a value in the capability-tree and sends out signals to subscribed nodes. A name like set_capability_value
or set_value
may be more consistent.
Should get_message
be _get_message
and be semi-private? Or can we think of a public use for get_message?
Yeah this might be semi_private. But what if you implement your own loop and you already have a socket listener yourself. Then you don't want to call run_once() but rather do it yourself? I'm not sure if this holds.
How do you find the the method names we have now? Do they make sense? Are they confusing?
I want to make sure they make sense immediately. This counts for the debug log as well. Method names we have now, amongst others:
def peer_get(self, peer, keys)
: "Get data from peer"def peer_set(self, peer, data)
: "Set data on peer"def peer_call(self, peer, method, *args)
: "Call a method on a peer"def peer_subscribe(self, peer, emitter=None, receiver=None)
: "Subscribe a receiver to an emitter on a peer"def peer_unsubscribe(self, peer, emitter=None, receiver=None)
: "Unsubscribe a receiver to an emitter on a peer"def emit_signal(self, emitter, data)
: Can we possibly do this automatic?def on_peer_enter(self, peer, name, *args, **kwargs)
: "A peer has entered ... what?"def on_peer_exit(self, peer, name, *args, **kwargs)
: "A peer has exited"def on_peer_join(self, peer, name, grp, *args, **kwargs)
: "A peer has joined a group"def on_peer_leave(self, peer, name, grp, *args, **kwargs)
: "A peer has left a group"def on_peer_whisper(self, peer, name, data, *args, **kwargs)
: "A peer whispers a message"def on_peer_shout(self, peer, name, grp, data, *args, **kwargs)
: "A peer shouts a message"def on_peer_modified(self, peer, data, *args, **kwargs)
: "A peer modified something in its capability tree"def on_peer_replied(self, peer, data, *args, **kwargs)
: "A peer replied to some request you did"def on_peer_signaled(self, peer, data, *args, **kwargs)
: "A peer emitted a signal"def on_modified(self, data, peer=None)
: "Something was modified on this node"def get_message(self)
: "Gets waiting messages (used by run and run_once)"def run_once(self, timeout=None)
: "Gets waiting messages (and calls callbacks) and returns when finished"def run(self, timeout=None)
: "Continuously gets waiting messages (and calls callbacks)"