Search in sources :

Example 6 with Topology

use of com.ms.silverking.cloud.topology.Topology in project SilverKing by Morgan-Stanley.

the class TopologyRingCreator method main.

// //////////////////////////////////////////////////
/**
 * @param args
 */
public static void main(String[] args) {
    try {
        if (args.length != 8) {
            System.out.println("<topologyFile> <weightSpecsFile> <exclusionList> <nodeID> <storagePolicyGroup> <policyID> <HostGroupTableFile> <HostGroup,...>");
        } else {
            TopologyRingCreator topologyRingCreator;
            Topology topology;
            File topologyFile;
            File weightSpecsFile;
            File exclusionFile;
            File storagePolicyGroupFile;
            String nodeID;
            String policyID;
            // Replication replication;
            StoragePolicyGroup storagePolicyGroup;
            TopologyRing topologyRing;
            Node node;
            RingTreeRecipe recipe;
            HostGroupTable hostGroupTable;
            Set<String> hostGroups;
            // Log.setLevelAll();
            topologyFile = new File(args[0]);
            weightSpecsFile = new File(args[1]);
            exclusionFile = new File(args[2]);
            nodeID = args[3];
            storagePolicyGroupFile = new File(args[4]);
            policyID = args[5];
            storagePolicyGroup = new PolicyParser().parsePolicyGroup(storagePolicyGroupFile, VersionedDefinition.NO_VERSION);
            topology = TopologyParser.parse(topologyFile);
            topologyRingCreator = new TopologyRingCreator();
            hostGroupTable = HostGroupTable.parse(args[6], VersionedDefinition.NO_VERSION);
            hostGroups = ImmutableSet.copyOf(args[7].split(","));
            recipe = new RingTreeRecipe(topology, topology.getNodeByID(nodeID), new WeightSpecifications(VersionedDefinition.NO_VERSION).parse(weightSpecsFile), ExclusionSet.parse(exclusionFile), storagePolicyGroup, policyID, hostGroupTable, hostGroups, // version not
            0L, // this tree
            DHTUtil.currentTimeMillis());
            System.out.println("RingTreeRecipe: " + recipe);
            topologyRing = topologyRingCreator.create(recipe, nodeID);
            System.out.println("\n\nTopologyRing:\n");
            System.out.println(topologyRing);
            System.out.println("\n\n");
            topologyRing = topologyRingCreator.reduceDataMovement(topologyRing, topologyRing, recipe);
            System.out.println(topologyRing);
        }
    } catch (Exception e) {
        Log.logErrorWarning(e);
    }
}
Also used : PolicyParser(com.ms.silverking.cloud.storagepolicy.PolicyParser) Node(com.ms.silverking.cloud.topology.Node) GenericNode(com.ms.silverking.cloud.topology.GenericNode) HostGroupTable(com.ms.silverking.cloud.config.HostGroupTable) Topology(com.ms.silverking.cloud.topology.Topology) StoragePolicyGroup(com.ms.silverking.cloud.storagepolicy.StoragePolicyGroup) WeightSpecifications(com.ms.silverking.cloud.toporing.meta.WeightSpecifications) File(java.io.File)

Example 7 with Topology

use of com.ms.silverking.cloud.topology.Topology in project SilverKing by Morgan-Stanley.

the class MetaClient method test.

public void test() throws Exception {
    Topology topology;
    topology = TopologyParser.parse(new File("c:/tmp/topo2.txt"));
    System.out.println(topology);
}
Also used : Topology(com.ms.silverking.cloud.topology.Topology) File(java.io.File)

Aggregations

Topology (com.ms.silverking.cloud.topology.Topology)7 HostGroupTable (com.ms.silverking.cloud.config.HostGroupTable)5 StoragePolicyGroup (com.ms.silverking.cloud.storagepolicy.StoragePolicyGroup)5 WeightSpecifications (com.ms.silverking.cloud.toporing.meta.WeightSpecifications)5 File (java.io.File)4 TopologyZK (com.ms.silverking.cloud.topology.TopologyZK)3 ExclusionSet (com.ms.silverking.cloud.meta.ExclusionSet)2 HostGroupTableZK (com.ms.silverking.cloud.meta.HostGroupTableZK)2 PolicyParser (com.ms.silverking.cloud.storagepolicy.PolicyParser)2 NamedRingConfiguration (com.ms.silverking.cloud.toporing.meta.NamedRingConfiguration)2 RingConfiguration (com.ms.silverking.cloud.toporing.meta.RingConfiguration)2 RingConfigurationZK (com.ms.silverking.cloud.toporing.meta.RingConfigurationZK)2 ZooKeeperExtended (com.ms.silverking.cloud.zookeeper.ZooKeeperExtended)2 IOException (java.io.IOException)2 KeeperException (org.apache.zookeeper.KeeperException)2 CloudConfiguration (com.ms.silverking.cloud.meta.CloudConfiguration)1 ExclusionZK (com.ms.silverking.cloud.meta.ExclusionZK)1 ServerSetExtensionZK (com.ms.silverking.cloud.meta.ServerSetExtensionZK)1 PolicyParseException (com.ms.silverking.cloud.storagepolicy.PolicyParseException)1 StoragePolicyZK (com.ms.silverking.cloud.storagepolicy.StoragePolicyZK)1