Package com.yahoo.config.provision
Class Capacity
- java.lang.Object
-
- com.yahoo.config.provision.Capacity
-
public final class Capacity extends java.lang.Object
A capacity request.- Author:
- Ulf Lilleengen, bratseth
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description boolean
canFail()
Returns true if an exception should be thrown if the specified capacity can not be satisfied (to whatever policies are applied and taking required true/false into account).java.util.Optional<java.lang.String>
flavor()
Deprecated.use nodeResources insteadstatic Capacity
fromCount(int nodeCount, NodeResources resources)
Create a non-required, failable capacity requeststatic Capacity
fromCount(int nodeCount, NodeResources resources, boolean required, boolean canFail)
static Capacity
fromCount(int nodeCount, java.util.Optional<NodeResources> resources, boolean required, boolean canFail)
static Capacity
fromNodeCount(int capacity)
Creates this from a desired node count: The request may be satisfied with a smaller number of nodes.static Capacity
fromNodeCount(int nodeCount, java.util.Optional<java.lang.String> flavor, boolean required, boolean canFail)
Deprecated.static Capacity
fromRequiredNodeType(NodeType type)
Creates this from a node typeboolean
isRequired()
Returns whether the requested number of nodes must be met exactly for a request for this to succeedint
nodeCount()
Returns the number of nodes requestedjava.util.Optional<NodeResources>
nodeResources()
Returns the resources requested for each node, or empty to leave this decision to provisioningjava.lang.String
toString()
NodeType
type()
Returns the node type (role) requested.
-
-
-
Method Detail
-
nodeCount
public int nodeCount()
Returns the number of nodes requested
-
flavor
@Deprecated public java.util.Optional<java.lang.String> flavor()
Deprecated.use nodeResources insteadThe node flavor requested, or empty if no legacy flavor name has been used. This may be satisfied by the requested flavor or a suitable replacement.
-
nodeResources
public java.util.Optional<NodeResources> nodeResources()
Returns the resources requested for each node, or empty to leave this decision to provisioning
-
isRequired
public boolean isRequired()
Returns whether the requested number of nodes must be met exactly for a request for this to succeed
-
canFail
public boolean canFail()
Returns true if an exception should be thrown if the specified capacity can not be satisfied (to whatever policies are applied and taking required true/false into account). Returns false if it is preferable to still succeed with partially satisfied capacity.
-
type
public NodeType type()
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.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
fromNodeCount
public static Capacity fromNodeCount(int capacity)
Creates this from a desired node count: The request may be satisfied with a smaller number of nodes.
-
fromCount
public static Capacity fromCount(int nodeCount, NodeResources resources)
Create a non-required, failable capacity request
-
fromCount
public static Capacity fromCount(int nodeCount, NodeResources resources, boolean required, boolean canFail)
-
fromCount
public static Capacity fromCount(int nodeCount, java.util.Optional<NodeResources> resources, boolean required, boolean canFail)
-
fromNodeCount
@Deprecated public static Capacity fromNodeCount(int nodeCount, java.util.Optional<java.lang.String> flavor, boolean required, boolean canFail)
Deprecated.
-
-