diff options
Diffstat (limited to 'config-provisioning/src/main/java/com/yahoo/config/provision')
3 files changed, 37 insertions, 26 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/Capacity.java b/config-provisioning/src/main/java/com/yahoo/config/provision/Capacity.java index 5e02e1105ae..7c13204c1e7 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/Capacity.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/Capacity.java @@ -16,11 +16,14 @@ public final class Capacity { private final boolean required; private final Optional<String> flavor; + + private final NodeType type; - private Capacity(int nodeCount, boolean required, Optional<String> flavor) { + private Capacity(int nodeCount, boolean required, Optional<String> flavor, NodeType type) { this.nodeCount = nodeCount; this.flavor = flavor; this.required = required; + this.type = type; } /** Returns the number of nodes requested */ @@ -35,6 +38,13 @@ public final class Capacity { */ public Optional<String> flavor() { return flavor; } + /** + * Returns the node type (role) requested. This is tenant nodes by default. + * If some other type is requested the node count and flavor may be ignored + * and all nodes of the requested type returned instead. + */ + public NodeType type() { return type; } + @Override public String toString() { return nodeCount + " nodes " + ( flavor.isPresent() ? "of flavor " + flavor.get() : "(default flavor)" ); @@ -50,7 +60,7 @@ public final class Capacity { } /** Creates this from a desired node count: The request may be satisfied with a smaller number of nodes. */ public static Capacity fromNodeCount(int nodeCount, Optional<String> flavor) { - return new Capacity(nodeCount, false, flavor); + return new Capacity(nodeCount, false, flavor, NodeType.tenant); } /** Creates this from a required node count: Requests must fail unless the node count can be satisfied exactly */ @@ -63,7 +73,12 @@ public final class Capacity { } /** Creates this from a required node count: Requests must fail unless the node count can be satisfied exactly */ public static Capacity fromRequiredNodeCount(int nodeCount, Optional<String> flavor) { - return new Capacity(nodeCount, true, flavor); + return new Capacity(nodeCount, true, flavor, NodeType.tenant); + } + + /** Creates this from a node type */ + public static Capacity fromRequiredNodeType(NodeType type) { + return new Capacity(0, true, Optional.empty(), type); } } diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java new file mode 100644 index 00000000000..f77b40bc67e --- /dev/null +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/NodeType.java @@ -0,0 +1,19 @@ +package com.yahoo.config.provision; + +/** + * The possible types of nodes in the node repository + * + * @author bratseth + */ +public enum NodeType { + + /** A host of a set of (docker) tenant nodes */ + host, + + /** Nodes running the shared proxy layer */ + proxy, + + /** A node to be assigned to a tenant to run application workloads */ + tenant + +} diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/Quota.java b/config-provisioning/src/main/java/com/yahoo/config/provision/Quota.java deleted file mode 100644 index d09a401bfaa..00000000000 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/Quota.java +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.config.provision; - -/** - * @author hmusum - */ -public class Quota { - - private final int numberOfHosts; - - public Quota() { - this(Integer.MAX_VALUE); - } - - public Quota(int numberOfHosts) { - this.numberOfHosts = numberOfHosts; - } - - public int getNumberOfHosts() { - return numberOfHosts; - } - -} |