def __init__(self,
etcd_addrs,
key_to_poll,
etcd_scheme="http",
etcd_key=None,
etcd_cert=None,
etcd_ca=None,
poll_timeout=10,
connect_timeout=5):
super(EtcdWatcher, self).__init__(etcd_addrs,
etcd_scheme=etcd_scheme,
etcd_key=etcd_key,
etcd_cert=etcd_cert,
etcd_ca=etcd_ca)
self.etcd_timeout = Timeout(connect=connect_timeout,
read=poll_timeout)
self.key_to_poll = key_to_poll
self.next_etcd_index = None
# Forces a resync after the current poll if set. Safe to set from
# another thread. Automatically reset to False after the resync is
# triggered.
self.resync_after_current_poll = False
# Tells the watcher to stop after this poll. One-way flag.
self._stopped = False
self.dispatcher = PathDispatcher()
评论列表
文章目录