aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/search/NodeSpec.java
blob: 295bb069641e75c844d26a68ce72d61009f6b014 (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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.search;

/**
 * Represents the group and partition id of a search interface node.
 *
 * @author geirst
 */
public class NodeSpec {

    private final int groupIndex;
    private final int partitionId;

    public NodeSpec(int groupIndex, int partitionId) {
        if (groupIndex < 0) {
            throw new IllegalArgumentException("GroupId(" + groupIndex + ") can not be below 0");
        }
        if (partitionId < 0) {
            throw new IllegalArgumentException("PartId(" + partitionId + ") can not be below 0");
        }
        this.groupIndex = groupIndex;
        this.partitionId = partitionId;
    }

    /** 
     * Returns an index of the group of this node. 
     * This is a 0-base continuous integer id, not necessarily the same as the group id assigned by the
     * application/node repo.
     * This index is called a "row id" in some places in Vespa for historical reasons.
     */
    public int groupIndex() {
        return groupIndex;
    }

    /**
     * Returns the partition id of this, which is also a contiguous integer id, not necessarily
     * the same as the group id assigned by the application/node repo.
     */
    public int partitionId() {
        return partitionId;
    }

}