diff options
author | Ekaterina Chernova <efedorova@mirantis.com> | 2022-04-08 14:47:10 +0300 |
---|---|---|
committer | Ekaterina Chernova <efedorova@mirantis.com> | 2022-04-11 17:17:22 +0300 |
commit | c0f6cc0fe5a0ebf43368aab3e8897a0eac0ab489 (patch) | |
tree | 4f34eb2b8f327605f65c873bff18f52395155f92 | |
parent | 96f91b961ff593406a7cf9155e309d9988f8e2ae (diff) | |
download | tooz-c0f6cc0fe5a0ebf43368aab3e8897a0eac0ab489.tar.gz |
Enable watch functionality for Etcd3Driver
Add run_watchers support to Etcd3Driver.
Raise NotImplemented during leader change watch methods
to let corresponding tests pass since only group
membership is supported
Closes-bug: #1968323
Change-Id: Ibd46a3697b59cd22f386e60d29649acc5c5cd88a
-rw-r--r-- | tooz/drivers/etcd3gw.py | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/tooz/drivers/etcd3gw.py b/tooz/drivers/etcd3gw.py index d4a7693..169bf55 100644 --- a/tooz/drivers/etcd3gw.py +++ b/tooz/drivers/etcd3gw.py @@ -160,7 +160,8 @@ class Etcd3Lock(locking.Lock): return False -class Etcd3Driver(coordination.CoordinationDriverWithExecutor): +class Etcd3Driver(coordination.CoordinationDriverCachedRunWatchers, + coordination.CoordinationDriverWithExecutor): """An etcd based driver. This driver uses etcd provide the coordination driver semantics and @@ -234,18 +235,6 @@ class Etcd3Driver(coordination.CoordinationDriverWithExecutor): self._membership_lease.refresh() return min(self.lock_timeout, self.membership_timeout) - def watch_join_group(self, group_id, callback): - raise tooz.NotImplemented - - def unwatch_join_group(self, group_id, callback): - raise tooz.NotImplemented - - def watch_leave_group(self, group_id, callback): - raise tooz.NotImplemented - - def unwatch_leave_group(self, group_id, callback): - raise tooz.NotImplemented - def _encode_group_id(self, group_id): return _encode(self._prefix_group(group_id)) @@ -435,3 +424,11 @@ class Etcd3Driver(coordination.CoordinationDriverWithExecutor): group[1]['key'][len(self.GROUP_PREFIX):-1] for group in groups] return coordination.CoordinatorResult( self._executor.submit(_get_groups)) + + @staticmethod + def watch_elected_as_leader(group_id, callback): + raise tooz.NotImplemented + + @staticmethod + def unwatch_elected_as_leader(group_id, callback): + raise tooz.NotImplemented |