use of com.ms.silverking.cloud.toporing.meta.MetaClient in project SilverKing by Morgan-Stanley.
the class SKAdminShell method getRings.
private void getRings(String ringName) throws IOException, KeeperException {
MetaClient ringMC;
MetaPaths ringMP;
String ringConfigPath;
List<String> configs;
Triple<String, Long, Long> targetRing;
Triple<String, Long, Long> currentRing;
List<Triple<Long, String, String>> _rings;
currentRing = curTargetZK.getCurRingAndVersionPair();
targetRing = curTargetZK.getTargetRingAndVersionPair();
_rings = new ArrayList<>();
// ringMC = new MetaClient(new NamedRingConfiguration(ringName, null), zkConfig);
// ringMP = new MetaPaths(new NamedRingConfiguration(ringName, null));
ringConfigPath = MetaPaths.getRingConfigPath(ringName);
configs = zk.getChildren(ringConfigPath);
for (String config : configs) {
List<String> versions;
versions = zk.getChildren(ringConfigPath + "/" + config + "/instance");
for (String version : versions) {
String label;
Triple<String, Long, Long> ring;
ring = new Triple<>(ringName, Long.parseLong(config), Long.parseLong(version));
label = "";
if (currentRing.equals(ring)) {
label += "Current ";
}
if (targetRing.equals(ring)) {
label += "Target";
}
long creationTime;
creationTime = zk.getCreationTime(ringConfigPath + "/" + config + "/instance/" + ZooKeeperExtended.padVersion(Long.parseLong(version)));
_rings.add(new Triple<>(creationTime, String.format("%s,%d,%d", ringName, Long.parseLong(config), Long.parseLong(version)), label));
}
}
_rings.sort(new RingComparator());
rings = _rings;
}
Aggregations