aboutsummaryrefslogtreecommitdiffstats
path: root/config-model/src/main/java/com/yahoo/vespa/model/Affinity.java
blob: e882f6a2bb5c62b7f6f6f4dce8456d30f0af76c0 (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
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model;

/**
 * Represents a set of affinities that can be expressed by a service. Currently only supports
 * CPU socket affinity.
 *
 * @author Ulf Lilleengen
 */
public class Affinity {

    private final int cpuSocket;

    private Affinity(int cpuSocket) {
        this.cpuSocket = cpuSocket;
    }

    public int cpuSocket() {
        return cpuSocket;
    }

    public static Affinity none() {
        return new Builder().build();
    }

    public static class Builder {
        private int cpuSocket = -1;
        public Builder cpuSocket(int cpuSocket) {
            this.cpuSocket = cpuSocket;
            return this;
        }

        public Affinity build() {
            return new Affinity(cpuSocket);
        }
    }

}