Search in sources :

Example 1 with NodeInfo

use of com.ms.silverking.cloud.dht.daemon.NodeInfo in project SilverKing by Morgan-Stanley.

the class SystemNamespaceStore method getAllReplicasFreeSystemDiskBytesEstimate.

private byte[] getAllReplicasFreeSystemDiskBytesEstimate() {
    List<Pair<IPAndPort, Long>> results;
    Map<IPAndPort, NodeInfo> nodeInfo;
    results = new ArrayList<>();
    try {
        nodeInfo = getAllNodeInfo();
        for (IPAndPort node : ringMaster.getAllCurrentReplicaServers()) {
            NodeInfo info;
            info = nodeInfo.get(node);
            if (info != null) {
                long freeSystemBytesEstimate;
                freeSystemBytesEstimate = (long) ((double) info.getFSFreeBytes() / ringMaster.getCurrentOwnedFraction(node, OwnerQueryMode.Primary));
                results.add(new Pair<>(node, freeSystemBytesEstimate));
            }
        }
    } catch (KeeperException ke) {
        Log.logErrorWarning(ke);
    }
    return pairedResultsToBytes(results);
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) NodeInfo(com.ms.silverking.cloud.dht.daemon.NodeInfo) KeeperException(org.apache.zookeeper.KeeperException) Pair(com.ms.silverking.collection.Pair)

Example 2 with NodeInfo

use of com.ms.silverking.cloud.dht.daemon.NodeInfo in project SilverKing by Morgan-Stanley.

the class SystemNamespaceStore method getAllReplicasFreeDiskBytes.

private byte[] getAllReplicasFreeDiskBytes() {
    List<Pair<IPAndPort, Long>> results;
    Map<IPAndPort, NodeInfo> nodeInfo;
    results = new ArrayList<>();
    try {
        nodeInfo = getAllNodeInfo();
        for (IPAndPort node : ringMaster.getAllCurrentReplicaServers()) {
            NodeInfo info;
            info = nodeInfo.get(node);
            if (info != null) {
                results.add(new Pair<>(node, info.getFSFreeBytes()));
            }
        }
    } catch (KeeperException ke) {
        Log.logErrorWarning(ke);
    }
    return pairedResultsToBytes(results);
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) NodeInfo(com.ms.silverking.cloud.dht.daemon.NodeInfo) KeeperException(org.apache.zookeeper.KeeperException) Pair(com.ms.silverking.collection.Pair)

Example 3 with NodeInfo

use of com.ms.silverking.cloud.dht.daemon.NodeInfo in project SilverKing by Morgan-Stanley.

the class NodeInfoZK method getNodeInfo.

public Map<IPAndPort, NodeInfo> getNodeInfo(Set<IPAndPort> nodes) throws KeeperException {
    Map<IPAndPort, NodeInfo> allNodeInfo;
    allNodeInfo = new HashMap<>();
    for (IPAndPort node : nodes) {
        NodeInfo nodeInfo;
        nodeInfo = getNodeInfo(node);
        allNodeInfo.put(node, nodeInfo);
    }
    return allNodeInfo;
}
Also used : IPAndPort(com.ms.silverking.net.IPAndPort) NodeInfo(com.ms.silverking.cloud.dht.daemon.NodeInfo)

Aggregations

NodeInfo (com.ms.silverking.cloud.dht.daemon.NodeInfo)3 IPAndPort (com.ms.silverking.net.IPAndPort)3 Pair (com.ms.silverking.collection.Pair)2 KeeperException (org.apache.zookeeper.KeeperException)2