Skip to content
This repository
Browse code

Added multiple fixes to the voldemort ruby client

  • Loading branch information...
commit 6388c9439d0e9b6feba0495ec3b1e22e836d17a6 1 parent 3fea647
authored August 12, 2011
18  clients/ruby/lib/connection/connection.rb
@@ -85,12 +85,12 @@ def parse_nodes_from(doc)
85 85
     nodes = []
86 86
     doc.xpath("/cluster/server").each do |n|
87 87
       node = VoldemortNode.new      
88  
-      node.id = n.xpath("//id").text
89  
-      node.host = n.xpath("//host").text
90  
-      node.port = n.xpath("//socket-port").text
91  
-      node.http_port = n.xpath("//http_port").text
92  
-      node.admin_port = n.xpath("//admin-port").text
93  
-      node.partitions = n.xpath("//partitions").text
  88
+      node.id = n.xpath("id").text
  89
+      node.host = n.xpath("host").text
  90
+      node.port = n.xpath("socket-port").text
  91
+      node.http_port = n.xpath("http_port").text
  92
+      node.admin_port = n.xpath("admin-port").text
  93
+      node.partitions = n.xpath("partitions").text
94 94
       nodes << node
95 95
     end
96 96
     nodes
@@ -128,15 +128,15 @@ def rebalance_connection_if_needed
128 128
 
129 129
   def get(key)
130 130
     self.rebalance_connection_if_needed
131  
-    self.get_from(self.db_name, key, true)
  131
+    self.get_from(self.db_name, key, false)
132 132
   end
133 133
 
134 134
   def get_all(keys)
135 135
     self.rebalance_connection_if_needed
136  
-    self.get_all_from(self.db_name, keys, true)
  136
+    self.get_all_from(self.db_name, keys, false)
137 137
   end
138 138
 
139  
-  def put(key, value, version = nil, route = true)
  139
+  def put(key, value, version = nil, route = false)
140 140
     self.rebalance_connection_if_needed
141 141
     self.put_from(self.db_name, key, value, version, route)
142 142
   end
8  clients/ruby/lib/connection/tcp_connection.rb
@@ -28,7 +28,7 @@ def connect_to(host, port)
28 28
     end
29 29
   end
30 30
 
31  
-  def get_from(db_name, key, route = true)
  31
+  def get_from(db_name, key, route = false)
32 32
     request = VoldemortRequest.new
33 33
     request.should_route = route
34 34
     request.store = db_name
@@ -43,7 +43,7 @@ def get_from(db_name, key, route = true)
43 43
     response
44 44
   end
45 45
 
46  
-  def get_all_from(db_name, keys, route = true)
  46
+  def get_all_from(db_name, keys, route = false)
47 47
     request = VoldemortRequest.new
48 48
     request.should_route = route
49 49
     request.store = db_name
@@ -58,7 +58,7 @@ def get_all_from(db_name, keys, route = true)
58 58
     response
59 59
   end
60 60
 
61  
-  def put_from(db_name, key, value, version = nil, route = true)
  61
+  def put_from(db_name, key, value, version = nil, route = false)
62 62
     version = get_version(key) unless version
63 63
     request = VoldemortRequest.new
64 64
     request.should_route = route
@@ -80,7 +80,7 @@ def put_from(db_name, key, value, version = nil, route = true)
80 80
     version
81 81
   end
82 82
 
83  
-  def delete_from(db_name, key, version = nil, route = true)
  83
+  def delete_from(db_name, key, version = nil, route = false)
84 84
     version = get_version(key) unless version
85 85
     request = VoldemortRequest.new
86 86
     request.should_route = route
2  clients/ruby/lib/voldemort-serializer.rb
@@ -54,7 +54,7 @@ def read_slice(length, bytes)
54 54
   
55 55
   def to_bytes(object)
56 56
     bytes = ''
57  
-    newest_version = 0 # TODO get highest number from map
  57
+    newest_version = type_def_versions.size > 0 ? (type_def_versions.size-1) : 0
58 58
     type_def = @type_def_versions[newest_version]
59 59
     
60 60
     if(@has_version)
2  clients/ruby/voldemort-rb.gemspec
... ...
@@ -1,6 +1,6 @@
1 1
 Gem::Specification.new do |s|
2 2
   s.name = 'voldemort-rb'
3  
-  s.version = '0.1.5'
  3
+  s.version = '0.1.8'
4 4
   s.summary = %{A Ruby client for the Voldemort distributed key value store}
5 5
   s.description = %Q{voldemort-rb allows you to connect to the Voldemort descentralized key value store.}
6 6
   s.authors = ["Alejandro Crosa"]

0 notes on commit 6388c94

Please sign in to comment.
Something went wrong with that request. Please try again.