def watch(self, keys, on_watch, filters=None, start_revision=None, return_previous=None):
"""
Watch one or more keys or key sets and invoke a callback.
Watch watches for events happening or that have happened. The entire event history
can be watched starting from the last compaction revision.
:param keys: Watch these keys / key sets.
:type keys: list of bytes or list of instance of :class:`txaioetcd.KeySet`
:param on_watch: The callback to invoke upon receiving
a watch event.
:type on_watch: callable
:param start_revision: start_revision is an optional
revision to watch from (inclusive). No start_revision is "now".
:type start_revision: int
"""
d = self._start_watching(keys, on_watch, filters, start_revision, return_previous)
def on_err(err):
if err.type == CancelledError:
# swallow canceling!
pass
else:
return err
d.addErrback(on_err)
return d
评论列表
文章目录