Merge lp:~verterok/txstatsd/consistenthashing-py3k into lp:txstatsd

Proposed by Guillermo Gonzalez
Status: Merged
Approved by: Sidnei da Silva
Approved revision: 107
Merged at revision: 107
Proposed branch: lp:~verterok/txstatsd/consistenthashing-py3k
Merge into: lp:txstatsd
Diff against target: 36 lines (+4/-4)
2 files modified
txstatsd/client.py (+2/-2)
txstatsd/hashing.py (+2/-2)
To merge this branch: bzr merge lp:~verterok/txstatsd/consistenthashing-py3k
Reviewer Review Type Date Requested Status
Sidnei da Silva Approve
Review via email: mp+164023@code.launchpad.net

Commit message

add py3k support for the consistenthashing client

Description of the change

This branch adds py3k support for the consistenthashing client code.

To post a comment you must log in.
Revision history for this message
Sidnei da Silva (sidnei) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'txstatsd/client.py'
--- txstatsd/client.py 2013-01-08 14:54:00 +0000
+++ txstatsd/client.py 2013-05-15 18:59:30 +0000
@@ -38,7 +38,7 @@
38 # for sys.stdout.encoding at the module-level of twisted.python.log. See:38 # for sys.stdout.encoding at the module-level of twisted.python.log. See:
39 # http://twistedmatrix.com/trac/ticket/6244 for more details.39 # http://twistedmatrix.com/trac/ticket/6244 for more details.
40 pass40 pass
41 41
42from txstatsd.hashing import ConsistentHashRing42from txstatsd.hashing import ConsistentHashRing
4343
4444
@@ -111,7 +111,7 @@
111111
112 def write(self, data):112 def write(self, data):
113 """Hash based on the metric name, then send to the right client."""113 """Hash based on the metric name, then send to the right client."""
114 metric_name, rest = data.split(":", 1)114 metric_name, rest = str(data).split(":", 1)
115 client = self.ring.get_node(metric_name)115 client = self.ring.get_node(metric_name)
116 client.write(data)116 client.write(data)
117117
118118
=== modified file 'txstatsd/hashing.py'
--- txstatsd/hashing.py 2012-06-28 17:29:26 +0000
+++ txstatsd/hashing.py 2013-05-15 18:59:30 +0000
@@ -33,8 +33,8 @@
33 self.add_node(node)33 self.add_node(node)
3434
35 def compute_ring_position(self, key):35 def compute_ring_position(self, key):
36 big_hash = md5(str(key)).hexdigest()36 big_hash = md5(key.encode('utf-8')).hexdigest()
37 small_hash = long(big_hash[:8], 16)37 small_hash = int(big_hash[:8], 16)
38 return small_hash38 return small_hash
3939
40 def add_node(self, node):40 def add_node(self, node):

Subscribers

People subscribed via source and target branches