summaryrefslogtreecommitdiff
path: root/tooz/drivers/zake.py
diff options
context:
space:
mode:
authorDina Belova <dbelova@mirantis.com>2014-08-26 12:18:49 +0400
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-09-05 11:13:03 -0700
commitfaaeb41721c714f0d990a7b2a36a47f777e6cf48 (patch)
tree8523e0c1b7691777be88d62a7ed8fdba830a2939 /tooz/drivers/zake.py
parent54dd71907989fa194f5cf71c25e5208c76df1f4d (diff)
downloadtooz-faaeb41721c714f0d990a7b2a36a47f777e6cf48.tar.gz
Move Zake driver code to separated Python module
That is needed to prevent Zake driver load in real-life Zookeeper usage - currently we had the situation when even if you want to use just KaZoo, you needed to install partially test-requierements (zake package). Change-Id: I9664fda2d6e76a6e48776b4a6d92af4c4baf1425
Diffstat (limited to 'tooz/drivers/zake.py')
-rw-r--r--tooz/drivers/zake.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/tooz/drivers/zake.py b/tooz/drivers/zake.py
new file mode 100644
index 0000000..4e43ae1
--- /dev/null
+++ b/tooz/drivers/zake.py
@@ -0,0 +1,62 @@
+# Copyright (c) 2013-2014 Mirantis Inc. All Rights Reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+from __future__ import absolute_import
+
+from zake import fake_client
+from zake import fake_storage
+
+from tooz.drivers import zookeeper
+
+
+class ZakeDriver(zookeeper.BaseZooKeeperDriver):
+ """The driver using the Zake client which mimic a fake Kazoo client
+ without the need of real ZooKeeper servers.
+ """
+
+ # here we need to pass *threading handler* as an argument
+ 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 NotImplementedError
+
+ @staticmethod
+ def unwatch_join_group(group_id, callback):
+ raise NotImplementedError
+
+ @staticmethod
+ def watch_leave_group(group_id, callback):
+ raise NotImplementedError
+
+ @staticmethod
+ def unwatch_leave_group(group_id, callback):
+ raise NotImplementedError
+
+ @staticmethod
+ def watch_elected_as_leader(group_id, callback):
+ raise NotImplementedError
+
+ @staticmethod
+ def unwatch_elected_as_leader(group_id, callback):
+ raise NotImplementedError
+
+ @staticmethod
+ def run_watchers():
+ raise NotImplementedError