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));
}
}
}
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);
}
}
}
}
}
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();
}
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;
}
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');
}
Aggregations