aboutsummaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/hostinfo/StorageNodeStatsBridge.java
blob: 239fa1b433fd386d2ad9113a69260d404dfa12d7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core.hostinfo;

import com.yahoo.vespa.clustercontroller.core.*;

import java.util.HashMap;
import java.util.Map;

/**
 * Class used to create a StorageNodeStatsContainer from HostInfo.
 *
 * @author hakonhall
 */
public class StorageNodeStatsBridge {

    private StorageNodeStatsBridge() { }

    public static ContentClusterStats generate(Distributor distributor) {
        Map<Integer, ContentNodeStats> mapToNodeStats = new HashMap<>();
        for (StorageNode storageNode : distributor.getStorageNodes()) {
            mapToNodeStats.put(storageNode.getIndex(), new ContentNodeStats(storageNode));
        }
        return new ContentClusterStats(mapToNodeStats);
    }

}