Permalink
Browse files

Re-organized administrative tools.

  • Loading branch information...
1 parent c4c6e30 commit d6d487d142c38fb74aa7b2a29e7dd00bff5924e1 @afeinberg afeinberg committed Mar 15, 2010
@@ -18,4 +18,4 @@
base_dir=$(dirname $0)/..
-$base_dir/bin/run-class.sh voldemort.ClusterViewer $@
+$base_dir/bin/run-class.sh voldemort.VoldemortClusterViewer $@
@@ -1,4 +1,4 @@
-package voldemort.client.rebalance;
+package voldemort;
import com.google.common.base.Joiner;
import joptsimple.OptionParser;
@@ -15,10 +15,8 @@
/**
* Provides a command line interface to the {@link voldemort.client.protocol.admin.AdminClient}
- *
- * @author afeinberg
*/
-public class AdminCLI {
+public class VoldemortAdminTool {
public static void main (String [] args) throws Exception {
OptionParser parser = new OptionParser();
parser.accepts("help", "print help information");
@@ -26,19 +26,19 @@
* Inspect a cluster configuration to determine whether it can be rebalanced to a target cluster geometry.
*
*/
-public class ClusterViewer {
+public class VoldemortClusterViewer {
private final Cluster originalCluster;
private final StoreDefinition storeDefinition;
/**
- * Constructs a <code>ClusterViewer</code> initialized with an original cluster a store definition.
+ * Constructs a <code>VoldemortClusterViewer</code> initialized with an original cluster a store definition.
*
* @param originalCluster The original cluster
* @param storeDefinition A store definition, which specifies the replication-factor (needed to calculate routes).
*/
- public ClusterViewer(Cluster originalCluster,
+ public VoldemortClusterViewer(Cluster originalCluster,
StoreDefinition storeDefinition) {
this.originalCluster = originalCluster;
this.storeDefinition = storeDefinition;
@@ -47,7 +47,7 @@ public ClusterViewer(Cluster originalCluster,
/**
* Prints out the layout display mapping between replicas and their partitions for the cluster with which
- * the <code>ClusterViewer</code> has been constructed.
+ * the <code>VoldemortClusterViewer</code> has been constructed.
*/
public void viewMasterToReplica() {
viewMasterToReplica(originalCluster);
@@ -72,7 +72,7 @@ public void viewMasterToReplica(Cluster cluster) {
}
/**
- * Compares cluster with which the <code>ClusterViewer</code> has been constructed to another cluster,
+ * Compares cluster with which the <code>VoldemortClusterViewer</code> has been constructed to another cluster,
* determining the feasibility of rebalancing to that cluster's layout.
*
* @param target The target cluster geometry.
@@ -105,14 +105,14 @@ public void compareToCluster(Cluster target) {
/**
* Main method to run on test cluster/store XML files. Example usage with a <b>good</b> target cluster.xml:
* <code>
- * ./bin/run-class.sh voldemort.ClusterViewer \
+ * ./bin/run-class.sh voldemort.VoldemortClusterViewer \
* --cluster ./test/common/voldemort/config/rebalance-tool-original-cluster.xml \
* --stores ./test/common/voldemort/config/rebalance-tool-stores.xml \
* --store-name test --other-cluster ./test/common/voldemort/config/rebalance-tool-good-cluster.xml
* </code>
* Example usage with <b>bad</b> target cluster.xml:
* <code>
- * ./bin/run-class.sh voldemort.ClusterViewer \
+ * ./bin/run-class.sh voldemort.VoldemortClusterViewer \
* --cluster ./test/common/voldemort/config/rebalance-tool-original-cluster.xml \
* --stores ./test/common/voldemort/config/rebalance-tool-stores.xml \
* --store-name test --other-cluster ./test/common/voldemort/config/rebalance-tool-bad-cluster.xml
@@ -170,17 +170,17 @@ public static void main(String [] args) throws IOException {
if (storeDef == null)
Utils.croak("No store found with name \"" + storeName + "\"");
- ClusterViewer clusterViewer = new ClusterViewer(cluster, storeDef);
+ VoldemortClusterViewer voldemortClusterViewer = new VoldemortClusterViewer(cluster, storeDef);
System.out.println("Original cluster: ");
- clusterViewer.viewMasterToReplica();
+ voldemortClusterViewer.viewMasterToReplica();
if (options.has("other-cluster")) {
String otherClusterFile = (String) options.valueOf("other-cluster");
Cluster otherCluster = new ClusterMapper().readCluster(new BufferedReader(new FileReader(otherClusterFile)));
System.out.println("New cluster: ");
- clusterViewer.viewMasterToReplica(otherCluster);
- clusterViewer.compareToCluster(otherCluster);
+ voldemortClusterViewer.viewMasterToReplica(otherCluster);
+ voldemortClusterViewer.compareToCluster(otherCluster);
}
} catch (FileNotFoundException e) {
Utils.croak(e.getMessage());
@@ -5,7 +5,7 @@
import com.google.common.collect.ImmutableMap;
import joptsimple.OptionParser;
import joptsimple.OptionSet;
-import voldemort.ClusterViewer;
+import voldemort.VoldemortClusterViewer;
import voldemort.cluster.Cluster;
import voldemort.cluster.Node;
import voldemort.store.StoreDefinition;
@@ -105,10 +105,10 @@ public void build(String targetClusterXmlFile,
}
RebalanceClusterTool clusterTool = new RebalanceClusterTool(cluster, store);
- ClusterViewer clusterViewer = new ClusterViewer(cluster, store);
+ VoldemortClusterViewer voldemortClusterViewer = new VoldemortClusterViewer(cluster, store);
System.out.println("Original layout: ");
- clusterViewer.viewMasterToReplica();
+ voldemortClusterViewer.viewMasterToReplica();
Node template = new Node(cluster.getNumberOfNodes(),
host,
@@ -134,8 +134,8 @@ public void build(String targetClusterXmlFile,
Utils.croak("Unable to insert " + template + " into " + cluster);
System.out.println("Created target cluster layout: ");
- clusterViewer.viewMasterToReplica(targetCluster);
- clusterViewer.compareToCluster(targetCluster);
+ voldemortClusterViewer.viewMasterToReplica(targetCluster);
+ voldemortClusterViewer.compareToCluster(targetCluster);
String clusterXmlString = new ClusterMapper().writeCluster(targetCluster);
if (targetClusterXmlFile == null) {

0 comments on commit d6d487d

Please sign in to comment.