summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Harlow <harlowja@yahoo-inc.com>2014-09-18 14:32:30 -0700
committerJoshua Harlow <harlowja@yahoo-inc.com>2014-09-18 21:47:33 +0000
commit031f8146122a0b11f63b9b70ad6a590ea45431e8 (patch)
treeca284ccc38910d96350d6bb9266e0c7c9db59ee0
parent0df6d848ea733fbe0f732e1132687c9e14b668b2 (diff)
downloadtooz-031f8146122a0b11f63b9b70ad6a590ea45431e8.tar.gz
Standardize the async result subclasses0.4
Move away from these subclasses exposing there properties as publicly viewable and have them only expose the base class functions as things that are publicly useable. This also adjusts how the zookeeper async result had a usage of camelcasing that didn't seem to fit in the other naming conventions that tooz uses. Change-Id: Iaa1dd3bb7b359b2dab14a8aeeab9f2e3e9cd8d29
-rw-r--r--tooz/drivers/memcached.py10
-rw-r--r--tooz/drivers/zookeeper.py15
2 files changed, 12 insertions, 13 deletions
diff --git a/tooz/drivers/memcached.py b/tooz/drivers/memcached.py
index 54ad27e..b6c4740 100644
--- a/tooz/drivers/memcached.py
+++ b/tooz/drivers/memcached.py
@@ -361,10 +361,10 @@ class MemcachedAsyncResult(coordination.CoordAsyncResult):
"""
def __init__(self, result):
- self.result = result
+ self._result = result
def get(self, timeout=0):
- return self.result
+ return self._result
@staticmethod
def done():
@@ -379,10 +379,10 @@ class MemcachedAsyncError(coordination.CoordAsyncResult):
"""
def __init__(self, error):
- self.error = error
+ self._error = error
- def get(self, timeout=0):
- raise self.error
+ def get(self, timeout=10):
+ raise self._error
@staticmethod
def done():
diff --git a/tooz/drivers/zookeeper.py b/tooz/drivers/zookeeper.py
index de9be32..504ae04 100644
--- a/tooz/drivers/zookeeper.py
+++ b/tooz/drivers/zookeeper.py
@@ -368,14 +368,13 @@ class KazooDriver(BaseZooKeeperDriver):
class ZooAsyncResult(coordination.CoordAsyncResult):
+ def __init__(self, kazoo_async_result, handler, **kwargs):
+ self._kazoo_async_result = kazoo_async_result
+ self._handler = handler
+ self._kwargs = kwargs
- def __init__(self, kazooAsyncResult, handler, **kwargs):
- self.kazooAsyncResult = kazooAsyncResult
- self.handler = handler
- self.kwargs = kwargs
-
- def get(self, timeout=15):
- return self.handler(self.kazooAsyncResult, timeout, **self.kwargs)
+ def get(self, timeout=10):
+ return self._handler(self._kazoo_async_result, timeout, **self._kwargs)
def done(self):
- return self.kazooAsyncResult.ready()
+ return self._kazoo_async_result.ready()