Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved gat to VBucketAwareClient

Deprecated it in MemcachedClient

Change-Id: I805c7d8fcfac297ae23746ebb10173d94df5b4cc
Reviewed-on: http://review.couchbase.org/18014
Reviewed-by: Farshid Ghods <farshid@couchbase.com>
Reviewed-by: Volker Mische <volker.mische@gmail.com>
Tested-by: Benjamin Young <benjamin@couchbase.com>
  • Loading branch information...
commit 04f0472e63cd85759bd8aa69a007fa689b58ae45 1 parent f6c17b6
@BigBlueHat BigBlueHat authored BigBlueHat committed
View
3  couchbase/client.py
@@ -235,9 +235,6 @@ def replace(self, key, exp, flags, val):
def get(self, key):
return self.mc_client.get(key)
- def send_get(self, key):
- return self.mc_client.send_get(key)
-
def getl(self, key, exp=15):
return self.mc_client.getl(key, exp)
View
2  couchbase/memcachedclient.py
@@ -203,6 +203,8 @@ def touch(self, key, exp, vbucket=-1):
def gat(self, key, exp, vbucket=-1):
"""Get the value for a given key and touch it."""
+ warnings.warn("MemcachedClient.gat is deprecated; use "
+ "VBucketAwareClient.gat instead", DeprecationWarning)
self._set_vbucket_id(key, vbucket)
parts = self._doCmd(VBucketAwareConstants.CMD_GAT, key, '',
struct.pack(VBucketAwareConstants.GAT_PKT_FMT,
View
13 couchbase/tests/test_memcachedclient.py
@@ -126,3 +126,16 @@ def test_simple_touch(self):
self.assertTrue(self.client.get(key)[2] == value)
self.assertTrue(len(w) == 1)
self.assertTrue("deprecated" in str(w[-1].message))
+
+ @attr(cbv="1.0.0")
+ def test_gat(self):
+ w = setup_warning_catcher()
+ warnings.simplefilter("always")
+ key, value = str(uuid.uuid4()), str(uuid.uuid4())
+ self.client.set(key, 2, 0, value)
+ set_value = self.client.gat(key, 5)[2]
+ self.assertTrue(set_value == value)
+ time.sleep(3)
+ self.assertTrue(self.client.get(key)[2] == value)
+ self.assertTrue(len(w) == 1)
+ self.assertTrue("deprecated" in str(w[-1].message))
View
9 couchbase/tests/test_vbucketawareclient.py
@@ -45,3 +45,12 @@ def test_simple_touch(self):
self.client.touch(key, 5)
time.sleep(3)
self.assertTrue(self.client.get(key)[2] == value)
+
+ @attr(cbv="1.0.0")
+ def test_gat(self):
+ key, value = str(uuid.uuid4()), str(uuid.uuid4())
+ self.client.set(key, 2, 0, value)
+ set_value = self.client.gat(key, 5)[2]
+ self.assertTrue(set_value == value)
+ time.sleep(3)
+ self.assertTrue(self.client.get(key)[2] == value)
View
8 couchbase/vbucketawareclient.py
@@ -36,3 +36,11 @@ def touch(self, key, exp, vbucket=-1):
return self._doCmd(VBucketAwareConstants.CMD_TOUCH, key, '',
struct.pack(VBucketAwareConstants.TOUCH_PKT_FMT,
exp))
+
+ def gat(self, key, exp, vbucket=-1):
+ """Get the value for a given key and touch it."""
+ self._set_vbucket_id(key, vbucket)
+ parts = self._doCmd(VBucketAwareConstants.CMD_GAT, key, '',
+ struct.pack(VBucketAwareConstants.GAT_PKT_FMT,
+ exp))
+ return self._parse_get(parts)
Please sign in to comment.
Something went wrong with that request. Please try again.