use of com.ms.silverking.cloud.toporing.meta.WeightSpecifications in project SilverKing by Morgan-Stanley.
the class SingleRingZK method readFromZK.
/*
private static String topologyNodeNameAndStoragePolicyNameToMapName(String topologyNodeName, String policyName) {
return topologyNodeName + mapNameDelimiter + policyName;
}
private static Pair<String,String> mapNameToTopologyNodeNameAndStoragePolicyName(String mapName) {
String[] names;
names = mapName.split(mapNameDelimiter);
return new Pair<>(names[0], names[1]);
}
*/
@Override
public TopologyRing readFromZK(long version, MetaToolOptions options) throws KeeperException {
List<String> nodes;
SingleRing singleRing;
String storagePolicyName;
Map<String, String> defs;
Set<String> paths;
nodes = zk.getChildren(base);
storagePolicyName = nodes.get(nodes.indexOf(storagePolicyNameNode));
nodes.remove(versionNode);
nodes.remove(storagePolicyNameNode);
singleRing = new SingleRing(nodeClass, version, storagePolicyName);
paths = new HashSet<>();
for (String node : nodes) {
paths.add(base + "/" + node);
}
defs = zk.getStrings(paths);
for (String node : nodes) {
String def;
RingEntry entry;
def = defs.get(base + "/" + node);
if (TopoRingConstants.verbose) {
System.out.println("base: " + base);
System.out.println("def: " + def);
}
entry = RingEntry.parseZKDefs(topology, node, def);
singleRing.addEntry(entry);
}
// pass empty weight specifications since only the reallocator
// needs them
// FIXME - think about whether re-allocator will use this code
singleRing.freeze(new WeightSpecifications(0));
return singleRing;
}
Aggregations