Search in sources :

Example 21 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class ActiveProxyRetrieval method sendSecondaryReplicasUpdate.

private void sendSecondaryReplicasUpdate(SecondaryReplicasUpdate secondaryReplicasUpdate) {
    RetrievalResult result;
    result = secondaryReplicasUpdate.getResult();
    for (IPAndPort replica : secondaryReplicasUpdate.getReplicas()) {
        ProtoMessageGroup pmg;
        if (debug) {
            Log.warning("ActiveProxyRetrieval sending secondary replicas update to ", replica);
        }
        // pmg = createPutForSecondaryReplicas(result);
        pmg = createValueMessageForSecondaryReplicas(result);
        messageModule.getMessageGroupBase().send(pmg.toMessageGroup(), replica);
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) RetrievalResult(com.ms.silverking.cloud.dht.daemon.storage.protocol.RetrievalResult) ProtoMessageGroup(com.ms.silverking.cloud.dht.net.ProtoMessageGroup)

Example 22 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class MessageModule method establishConnections.

private void establishConnections() {
    for (IPAndPort replica : ringMaster.getAllCurrentReplicaServers()) {
        ProtoNopMessageGroup nop;
        nop = new ProtoNopMessageGroup(mgBase.getMyID());
        Log.warning("Priming: ", replica);
        mgBase.send(nop.toMessageGroup(), replica);
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) ProtoNopMessageGroup(com.ms.silverking.cloud.dht.net.ProtoNopMessageGroup)

Example 23 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class NodeRingMaster2 method getAllCurrentNonExcludedReplicaServers.

private Set<IPAndPort> getAllCurrentNonExcludedReplicaServers() {
    Set<IPAndPort> nonExcludedReplicas;
    Set<IPAndPort> allReplicas;
    ExclusionSet curExclusionSet;
    allReplicas = curMapState.getResolvedReplicaMap().allReplicas();
    // curExclusionSet = curMapState.getCurrentExclusionSet();
    curExclusionSet = latestExclusionSet;
    nonExcludedReplicas = ImmutableSet.copyOf(curExclusionSet.filterByIP(allReplicas));
    return nonExcludedReplicas;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) ExclusionSet(com.ms.silverking.cloud.meta.ExclusionSet)

Example 24 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class SimpleIPDistancePrioritizer method main.

public static void main(String[] args) {
    try {
        SimpleIPDistancePrioritizer p;
        IPAndPort[] ips;
        IPAndPort referenceIP;
        int mask;
        referenceIP = new IPAndPort(args[0]);
        mask = Integer.parseUnsignedInt(args[1], 16);
        ips = new IPAndPort[args.length - 2];
        for (int i = 2; i < args.length; i++) {
            ips[i - 2] = new IPAndPort(args[i]);
        }
        p = new SimpleIPDistancePrioritizer(referenceIP, mask);
        for (int i = 0; i < ips.length; i++) {
            for (int j = 0; j < ips.length; j++) {
                System.out.printf("%20s\t%20s\t%s\n", ips[i], ips[j], p.compare(ips[i], ips[j]));
            }
            System.out.println();
        }
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort)

Example 25 with IPAndPort

use of com.ms.silverking.net.IPAndPort in project SilverKing by Morgan-Stanley.

the class RingMapState method nodeListToIPAndPortSet.

// /////////////
private Set<IPAndPort> nodeListToIPAndPortSet(List<Node> replicaNodes) {
    ImmutableSet.Builder<IPAndPort> replicaSet;
    replicaSet = ImmutableSet.builder();
    for (Node replicaNode : replicaNodes) {
        if (!replicaNode.getNodeClass().equals(NodeClass.server)) {
            throw new RuntimeException("Unexpected non-server node class: " + replicaNode);
        }
        replicaSet.add(new IPAndPort(replicaNode.getIDString(), nodeID.getPort()));
    }
    return replicaSet.build();
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) ImmutableSet(com.google.common.collect.ImmutableSet) Node(com.ms.silverking.cloud.topology.Node)

Aggregations

IPAndPort (com.ms.silverking.net.IPAndPort)71 ImmutableSet (com.google.common.collect.ImmutableSet)9 KeeperException (org.apache.zookeeper.KeeperException)7 DaemonState (com.ms.silverking.cloud.dht.daemon.DaemonState)5 ExclusionSet (com.ms.silverking.cloud.meta.ExclusionSet)5 Node (com.ms.silverking.cloud.topology.Node)5 Pair (com.ms.silverking.collection.Pair)5 RingRegion (com.ms.silverking.cloud.ring.RingRegion)4 IOException (java.io.IOException)4 DHTNode (com.ms.silverking.cloud.dht.daemon.DHTNode)3 NodeInfo (com.ms.silverking.cloud.dht.daemon.NodeInfo)3 ConvergencePoint (com.ms.silverking.cloud.dht.daemon.storage.convergence.ConvergencePoint)3 RingEntry (com.ms.silverking.cloud.toporing.RingEntry)3 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Map (java.util.Map)3 Set (java.util.Set)3 ImmutableList (com.google.common.collect.ImmutableList)2