Search in sources :

Example 6 with Triple

use of com.ms.silverking.collection.Triple 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;
}
Also used : Triple(com.ms.silverking.collection.Triple) MetaClient(com.ms.silverking.cloud.toporing.meta.MetaClient) MetaPaths(com.ms.silverking.cloud.toporing.meta.MetaPaths)

Aggregations

Triple (com.ms.silverking.collection.Triple)6 VersionConstraint (com.ms.silverking.cloud.dht.VersionConstraint)3 DHTKey (com.ms.silverking.cloud.dht.common.DHTKey)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)2 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)2 DHTKeyIntEntry (com.ms.silverking.cloud.dht.collection.DHTKeyIntEntry)1 TableFullException (com.ms.silverking.cloud.dht.collection.TableFullException)1 CorruptValueException (com.ms.silverking.cloud.dht.common.CorruptValueException)1 KeyAndInteger (com.ms.silverking.cloud.dht.common.KeyAndInteger)1 MetaClient (com.ms.silverking.cloud.toporing.meta.MetaClient)1 MetaPaths (com.ms.silverking.cloud.toporing.meta.MetaPaths)1 HashedSetMap (com.ms.silverking.collection.HashedSetMap)1 ProcessExecutor (com.ms.silverking.process.ProcessExecutor)1 SimpleStopwatch (com.ms.silverking.time.SimpleStopwatch)1 Stopwatch (com.ms.silverking.time.Stopwatch)1 File (java.io.File)1 IOException (java.io.IOException)1 ByteBuffer (java.nio.ByteBuffer)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1