Search in sources :

Example 1 with IPAndPort

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

the class PrimarySecondaryIPListPair method toString.

public String toString(String primaryPrefix, String secondaryPrefix, String psDelimiter) {
    StringBuilder sb;
    sb = new StringBuilder();
    sb.append(primaryPrefix);
    for (IPAndPort owner : primaryOwners) {
        sb.append(owner);
        sb.append(' ');
    }
    sb.append(psDelimiter);
    sb.append(secondaryPrefix);
    for (IPAndPort owner : secondaryOwners) {
        sb.append(owner);
        sb.append(' ');
    }
    return sb.toString();
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort)

Example 2 with IPAndPort

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

the class ResolvedReplicaMap method nodesToIPAndPort.

private static IPAndPort[] nodesToIPAndPort(List<Node> replicaNodes) {
    IPAndPort[] replicas;
    replicas = new IPAndPort[replicaNodes.size()];
    for (int i = 0; i < replicas.length; i++) {
        replicas[i] = new IPAndPort(replicaNodes.get(i).getIDString(), DHTNode.getServerPort());
    }
    return replicas;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort)

Example 3 with IPAndPort

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

the class ExclusionSet method asIPAndPortSet.

public Set<IPAndPort> asIPAndPortSet(int port) {
    Set<IPAndPort> s;
    s = new HashSet<>();
    for (String server : serverSet.getServers()) {
        s.add(new IPAndPort(server, port));
    }
    return ImmutableSet.copyOf(s);
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort)

Example 4 with IPAndPort

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

the class ExclusionSet method filterByIP.

public List<IPAndPort> filterByIP(Collection<IPAndPort> raw) {
    List<IPAndPort> filtered;
    filtered = new ArrayList<>(raw.size());
    for (IPAndPort node : raw) {
        boolean excluded;
        excluded = false;
        for (String server : getServers()) {
            if (node.getIPAsString().equals(server)) {
                excluded = true;
                break;
            }
        }
        if (!excluded) {
            filtered.add(node);
        }
    }
    return filtered;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort)

Example 5 with IPAndPort

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

the class RingEntry method nodesToIPAndPort.

private static IPAndPort[] nodesToIPAndPort(List<Node> replicaNodes) {
    IPAndPort[] replicas;
    replicas = new IPAndPort[replicaNodes.size()];
    for (int i = 0; i < replicas.length; i++) {
        replicas[i] = new IPAndPort(replicaNodes.get(i).getIDString(), DHTNode.getServerPort());
    }
    return replicas;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort)

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