Let zake act as a in-memory fully functional driver
The zake driver should theoretically function the same as the non-local driver so all the same kazoo functions should work, without the whole distributed part as they work with the regular zookeeper backed kazoo driver. Change-Id: I19df0da0e58c5624ca1b10f61c42510f1f104847changes/62/120962/8
parent
3981a3a300
commit
ac6f7d93db
|
@ -6,6 +6,7 @@ iso8601
|
|||
kazoo>=1.3.1
|
||||
oslo.config
|
||||
pymemcache>=1.2
|
||||
zake>=0.1.6
|
||||
posix_ipc
|
||||
msgpack-python
|
||||
retrying
|
||||
|
|
|
@ -7,5 +7,4 @@ python-subunit
|
|||
testrepository>=0.0.17
|
||||
testtools>=0.9.32
|
||||
testscenarios>=0.4
|
||||
zake>=0.1
|
||||
coverage>=3.6
|
||||
|
|
|
@ -17,11 +17,10 @@ from __future__ import absolute_import
|
|||
from zake import fake_client
|
||||
from zake import fake_storage
|
||||
|
||||
import tooz
|
||||
from tooz.drivers import zookeeper
|
||||
|
||||
|
||||
class ZakeDriver(zookeeper.BaseZooKeeperDriver):
|
||||
class ZakeDriver(zookeeper.KazooDriver):
|
||||
"""The driver using the Zake client which mimic a fake Kazoo client
|
||||
without the need of real ZooKeeper servers.
|
||||
"""
|
||||
|
@ -30,34 +29,6 @@ class ZakeDriver(zookeeper.BaseZooKeeperDriver):
|
|||
fake_storage = fake_storage.FakeStorage(
|
||||
fake_client.k_threading.SequentialThreadingHandler())
|
||||
|
||||
def __init__(self, member_id, parsed_url, options):
|
||||
super(ZakeDriver, self).__init__(member_id, parsed_url, options)
|
||||
self._coord = fake_client.FakeClient(storage=self.fake_storage)
|
||||
|
||||
@staticmethod
|
||||
def watch_join_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
|
||||
@staticmethod
|
||||
def unwatch_join_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
|
||||
@staticmethod
|
||||
def watch_leave_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
|
||||
@staticmethod
|
||||
def unwatch_leave_group(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
|
||||
@staticmethod
|
||||
def watch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
|
||||
@staticmethod
|
||||
def unwatch_elected_as_leader(group_id, callback):
|
||||
raise tooz.NotImplemented
|
||||
|
||||
@staticmethod
|
||||
def run_watchers():
|
||||
raise tooz.NotImplemented
|
||||
@classmethod
|
||||
def _make_client(cls, parsed_url, options):
|
||||
return fake_client.FakeClient(storage=cls.fake_storage)
|
||||
|
|
|
@ -207,9 +207,13 @@ class KazooDriver(BaseZooKeeperDriver):
|
|||
|
||||
def __init__(self, member_id, parsed_url, options):
|
||||
super(KazooDriver, self).__init__(member_id, parsed_url, options)
|
||||
self._coord = client.KazooClient(hosts=parsed_url.netloc)
|
||||
self._coord = self._make_client(parsed_url, options)
|
||||
self._member_id = member_id
|
||||
|
||||
@classmethod
|
||||
def _make_client(cls, parsed_url, options):
|
||||
return client.KazooClient(hosts=parsed_url.netloc)
|
||||
|
||||
def _watch_group(self, group_id):
|
||||
get_members_req = self.get_members(group_id)
|
||||
|
||||
|
|
Loading…
Reference in New Issue