Permalink
Browse files

pull from voldemort master.

  • Loading branch information...
2 parents f678066 + f15e2cd commit edb84f614b08ceebe4bce963859dadd299505961 @bbansal bbansal committed Nov 21, 2009
View
@@ -44,5 +44,6 @@
<classpathentry kind="lib" path="lib/je-3.3.87.jar"/>
<classpathentry kind="lib" path="lib/protobuf-java-2.2.0.jar"/>
<classpathentry kind="lib" path="contrib/ec2-testing/lib/typica.jar"/>
+ <classpathentry kind="lib" path="lib/h2-lzf.jar"/>
<classpathentry kind="output" path="classes"/>
</classpath>
View
2 NOTICE
@@ -25,6 +25,8 @@ This product includes jdom, a library developed by jdom.org.
This product includes jopt-simple, a library for parsing command line options (http://jopt-simple.sourceforge.net/).
+This product includes h2-lzf, which contains classes for LZF compression originally found in the H2 database (http://www.h2database.com/html/main.html). H2 is dual licensed and available under a modified version of the MPL 1.1 (Mozilla Public License) or under the (unmodified) EPL 1.0 (Eclipse Public License).
+
This product includes BDB, Java edition, A library developed by Oracle (http://www.oracle.com/database/berkeley-db/je/index.html), which includes
the following license information:
View
@@ -16,12 +16,12 @@
# limitations under the License.
#
-if [ $# != 2 ];
+if [ $# -lt 2 ];
then
echo 'USAGE: bin/voldemort-shell.sh store_name bootstrap_url [command_file]'
exit 1
fi
base_dir=$(dirname $0)/..
-$base_dir/bin/run-class.sh jline.ConsoleRunner voldemort.VoldemortClientShell $@
+$base_dir/bin/run-class.sh jline.ConsoleRunner voldemort.VoldemortClientShell $@
@@ -0,0 +1,42 @@
+require 'time'
+require 'rexml/document'
+include REXML
+
+class VoldemortNode
+ """A Voldemort node with the appropriate host and port information for contacting that node"""
+
+ attr_reader :id, :host, :socket_port, :http_port, :partitions, :is_available, :last_contact
+
+ def initialize(id, host, socket_port, http_port, partitions, is_available = true, last_contact = nil)
+ @id = id
+ @host = host
+ @socket_port = socket_port
+ @http_port = http_port
+ @partitions = partitions
+ @is_available = is_available
+ if not last_contact
+ @last_contact = Time.new.to_f
+ end
+ end
+
+ def inspect()
+ return "node(id = #{@id}, host = #{@host}, socket_port = #{@socket_port}, http_port = #{@http_port}, partitions = #{@partitions.map {|i| i.to_s}.join(', ')})"
+ end
+
+ #@staticmethod
+ def self.parse_cluster(xml)
+ """Parse the cluster.xml file and return a dictionary of the nodes in the cluster indexed by node id """
+ doc = Document.new(xml)
+ nodes = {}
+ XPath.each(doc, '//server') do |curr|
+ id = curr.elements['id'].text.to_i
+ host = curr.elements['host'].text
+ http_port = curr.elements['http-port'].text.to_i
+ socket_port = curr.elements['socket-port'].text.to_i
+ partition_str = curr.elements['partitions'].text
+ partitions = partition_str.split(/, */).map {|p| p.to_i}
+ nodes[id] = VoldemortNode.new(id, host, socket_port, http_port, partitions)
+ end
+ return nodes
+ end
+end
Oops, something went wrong.

0 comments on commit edb84f6

Please sign in to comment.