Search in sources :

Example 1 with Node

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

the class RingTreeBuilder method buildMaps.

private static void buildMaps(Map<String, TopologyRing> maps, Node node, RingTreeRecipe recipe) {
    if (node.getChildren().size() > 0 && recipe.hasDescendantInHostGroups(node)) {
        buildNodeMap(maps, node, recipe);
        System.out.printf("node %s children %s\n", node.getIDString(), CollectionUtil.toString(node.getChildren()));
        for (Node child : node.getChildren()) {
            if (child.getNodeClass() != NodeClass.server) {
                for (String subPolicyName : recipe.storagePolicy.getSubPolicyNamesForNodeClass(child.getNodeClass(), child)) {
                    RingTreeRecipe _recipe;
                    // need to change the storagePolicy for the below recipe
                    _recipe = recipe.newParentAndStoragePolicy(child, subPolicyName);
                    buildMaps(maps, child, _recipe);
                }
            }
        }
    } else {
        if (!recipe.hasDescendantInHostGroups(node)) {
            System.out.printf("%s has no descendant in host groups %s\n", node.getIDString(), CollectionUtil.toString(recipe.hostGroups));
        }
    }
}
Also used : Node(com.ms.silverking.cloud.topology.Node) GenericNode(com.ms.silverking.cloud.topology.GenericNode)

Example 2 with Node

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

the class RingTreeBuilder method buildMaps.

private static void buildMaps(Map<String, TopologyRing> maps, Node node, RingTreeRecipe recipe, RingTree sourceTree) {
    Log.warningf("buildMaps %s", node.getIDString());
    if (node.getChildren().size() > 0 && recipe.hasDescendantInHostGroups(node)) {
        buildNodeMap(maps, node, recipe, sourceTree);
        for (Node child : node.getChildren()) {
            Log.warningf("Child of %s is %s", node.getIDString(), child.getIDString());
            if (child.getNodeClass() != NodeClass.server) {
                for (String subPolicyName : recipe.storagePolicy.getSubPolicyNamesForNodeClass(child.getNodeClass(), child)) {
                    RingTreeRecipe _recipe;
                    // need to change the storagePolicy for the below recipe
                    _recipe = recipe.newParentAndStoragePolicy(child, subPolicyName);
                    buildMaps(maps, child, _recipe, sourceTree);
                }
            }
        }
    }
}
Also used : Node(com.ms.silverking.cloud.topology.Node) GenericNode(com.ms.silverking.cloud.topology.GenericNode)

Example 3 with Node

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

the class SingleRing method freeze.

// private void freeze(Map<String, Double> weights) {
// this.weights = weights;
// super.freeze();
// }
@Override
public void freeze(WeightSpecifications weightSpecs) {
    Map<String, Double> _weights;
    _weights = new HashMap<>();
    for (Node node : getMemberNodes(OwnerQueryMode.All)) {
        _weights.put(node.getIDString(), weightSpecs.getWeight(node));
    }
    this.weights = ImmutableMap.copyOf(_weights);
    super.freeze();
}
Also used : Node(com.ms.silverking.cloud.topology.Node)

Example 4 with Node

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

the class WeightSpecifications method getWeights.

public List<Double> getWeights(List<Node> nodes) {
    List<Double> weights;
    weights = new ArrayList<>(nodes.size());
    for (Node node : nodes) {
        weights.add(getWeight(node));
    }
    return weights;
}
Also used : Node(com.ms.silverking.cloud.topology.Node)

Example 5 with Node

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

the class RegionServers method addList.

private void addList(StringBuilder sb, String name, List<Node> nodes) {
    sb.append(name);
    sb.append('\n');
    for (Node node : nodes) {
        sb.append(node);
        sb.append(' ');
    }
    sb.append('\n');
}
Also used : Node(com.ms.silverking.cloud.topology.Node)

Aggregations

Node (com.ms.silverking.cloud.topology.Node)50 GenericNode (com.ms.silverking.cloud.topology.GenericNode)17 DHTNode (com.ms.silverking.cloud.dht.daemon.DHTNode)10 ImmutableSet (com.google.common.collect.ImmutableSet)6 IPAndPort (com.ms.silverking.net.IPAndPort)5 NodeClass (com.ms.silverking.cloud.topology.NodeClass)4 SubPolicy (com.ms.silverking.cloud.storagepolicy.SubPolicy)2 SubPolicyMember (com.ms.silverking.cloud.storagepolicy.SubPolicyMember)2 RingInteger (com.ms.silverking.numeric.RingInteger)2 ImmutableList (com.google.common.collect.ImmutableList)1 HostGroupTable (com.ms.silverking.cloud.config.HostGroupTable)1 PolicyParser (com.ms.silverking.cloud.storagepolicy.PolicyParser)1 StoragePolicy (com.ms.silverking.cloud.storagepolicy.StoragePolicy)1 StoragePolicyGroup (com.ms.silverking.cloud.storagepolicy.StoragePolicyGroup)1 Topology (com.ms.silverking.cloud.topology.Topology)1 WeightSpecifications (com.ms.silverking.cloud.toporing.meta.WeightSpecifications)1 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)1 Stopwatch (com.ms.silverking.time.Stopwatch)1 File (java.io.File)1 BigDecimal (java.math.BigDecimal)1