summaryrefslogtreecommitdiffstats
path: root/config-provisioning/src/main/java/com/yahoo/config/provision/Capacity.java
diff options
context:
space:
mode:
Diffstat (limited to 'config-provisioning/src/main/java/com/yahoo/config/provision/Capacity.java')
-rw-r--r--config-provisioning/src/main/java/com/yahoo/config/provision/Capacity.java21
1 files changed, 18 insertions, 3 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);
}
}