summaryrefslogtreecommitdiffstats
path: root/clustercontroller-core/src/main/java/com/yahoo/vespa/clustercontroller/core/StorageNodeStatsContainer.java
blob: ca8fcfb97eae6ab3983cf43ef4331e05550fc837 (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
27
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core;

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

/**
 * Contains stats for a set of storage nodes. This is used to store the stats returned
 * by Distributors from their getnodestate RPCs. The stats for a single storage node
 * is represented by the StorageNodeStats class.
 *
 * @author hakonhall
 */
public class StorageNodeStatsContainer {

    final private Map<Integer, StorageNodeStats> storageNodesByIndex = new HashMap<>();

    public void put(int nodeIndex, StorageNodeStats nodeStats) {
        storageNodesByIndex.put(nodeIndex, nodeStats);
    }

    public StorageNodeStats get(int nodeIndex) {
        return storageNodesByIndex.get(nodeIndex);
    }

    public int size() { return storageNodesByIndex.size(); }
}