summaryrefslogtreecommitdiffstats
path: root/config-provisioning/src/main/java/com/yahoo/config/provision/SharedHosts.java
blob: ec2660f45c8fdb81959e882b31fe8b7ec7bdf43a (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
package com.yahoo.config.provision;

/**
 * @author hakonhall
 */
public interface SharedHosts {

    /** Whether there are any shared hosts specifically for the given cluster type, or without a cluster type restriction. */
    boolean supportsClusterType(ClusterSpec.Type clusterType);

    /** Whether there are any shared hosts specifically for the given cluster type. */
    boolean hasClusterType(ClusterSpec.Type clusterType);

    static SharedHosts empty() { return ofConstant(false, false); }

    static SharedHosts ofConstant(boolean supportsClusterType, boolean hasClusterType) {
        return new SharedHosts() {
            @Override public boolean supportsClusterType(ClusterSpec.Type clusterType) { return supportsClusterType; }
            @Override public boolean hasClusterType(ClusterSpec.Type clusterType) { return hasClusterType; }
        };
    }

}