Search in sources :

Example 6 with MetaClient

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;
}
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

MetaClient (com.ms.silverking.cloud.toporing.meta.MetaClient)6 InstantiatedRingTree (com.ms.silverking.cloud.toporing.InstantiatedRingTree)3 HostGroupTable (com.ms.silverking.cloud.config.HostGroupTable)1 CloudConfiguration (com.ms.silverking.cloud.meta.CloudConfiguration)1 ExclusionSet (com.ms.silverking.cloud.meta.ExclusionSet)1 ExclusionZK (com.ms.silverking.cloud.meta.ExclusionZK)1 HostGroupTableZK (com.ms.silverking.cloud.meta.HostGroupTableZK)1 StoragePolicyGroup (com.ms.silverking.cloud.storagepolicy.StoragePolicyGroup)1 StoragePolicyZK (com.ms.silverking.cloud.storagepolicy.StoragePolicyZK)1 Topology (com.ms.silverking.cloud.topology.Topology)1 TopologyZK (com.ms.silverking.cloud.topology.TopologyZK)1 MetaPaths (com.ms.silverking.cloud.toporing.meta.MetaPaths)1 NamedRingConfiguration (com.ms.silverking.cloud.toporing.meta.NamedRingConfiguration)1 RingConfiguration (com.ms.silverking.cloud.toporing.meta.RingConfiguration)1 RingConfigurationZK (com.ms.silverking.cloud.toporing.meta.RingConfigurationZK)1 WeightSpecifications (com.ms.silverking.cloud.toporing.meta.WeightSpecifications)1 ZooKeeperConfig (com.ms.silverking.cloud.zookeeper.ZooKeeperConfig)1 Triple (com.ms.silverking.collection.Triple)1 IOException (java.io.IOException)1 KeeperException (org.apache.zookeeper.KeeperException)1