Package com.yahoo.config.provision
Class NodeResources
- java.lang.Object
-
- com.yahoo.config.provision.NodeResources
-
public class NodeResources extends Object
The node resources required by an application cluster- Author:
- bratseth
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
NodeResources.Architecture
static class
NodeResources.DiskSpeed
static class
NodeResources.StorageType
-
Constructor Summary
Constructors Constructor Description NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps)
NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed)
NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType)
NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType, NodeResources.Architecture architecture)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description NodeResources
add(NodeResources other)
NodeResources.Architecture
architecture()
Optional<NodeResources>
asOptional()
Returns this.isUnspecified() ? Optional.empty() : Optional.of(this)double
bandwidthGbps()
boolean
compatibleWith(NodeResources other)
Returns true if all the resources of this are the same as or compatible with the given resourcesdouble
cost()
Returns the standard cost of these resources, in dollars per hourdouble
diskGb()
NodeResources.DiskSpeed
diskSpeed()
double
distanceTo(NodeResources other)
boolean
equals(Object o)
static NodeResources
fromLegacyName(String name)
Create this from serial form.int
hashCode()
boolean
isUnspecified()
NodeResources
justNonNumbers()
Returns this with all numbers set to 0NodeResources
justNumbers()
Returns this with disk speed and storage type set to anydouble
memoryGb()
boolean
satisfies(NodeResources other)
Returns true if all the resources of this are the same or larger than the given resourcesNodeResources.StorageType
storageType()
NodeResources
subtract(NodeResources other)
String
toString()
static NodeResources
unspecified()
double
vcpu()
NodeResources
with(NodeResources.DiskSpeed diskSpeed)
NodeResources
with(NodeResources.StorageType storageType)
NodeResources
withBandwidthGbps(double bandwidthGbps)
NodeResources
withDiskGb(double diskGb)
NodeResources
withMemoryGb(double memoryGb)
NodeResources
withVcpu(double vcpu)
static NodeResources
zero()
-
-
-
Constructor Detail
-
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps)
-
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed)
-
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType)
-
NodeResources
public NodeResources(double vcpu, double memoryGb, double diskGb, double bandwidthGbps, NodeResources.DiskSpeed diskSpeed, NodeResources.StorageType storageType, NodeResources.Architecture architecture)
-
-
Method Detail
-
vcpu
public double vcpu()
-
memoryGb
public double memoryGb()
-
diskGb
public double diskGb()
-
bandwidthGbps
public double bandwidthGbps()
-
diskSpeed
public NodeResources.DiskSpeed diskSpeed()
-
storageType
public NodeResources.StorageType storageType()
-
architecture
public NodeResources.Architecture architecture()
-
cost
public double cost()
Returns the standard cost of these resources, in dollars per hour
-
withVcpu
public NodeResources withVcpu(double vcpu)
-
withMemoryGb
public NodeResources withMemoryGb(double memoryGb)
-
withDiskGb
public NodeResources withDiskGb(double diskGb)
-
withBandwidthGbps
public NodeResources withBandwidthGbps(double bandwidthGbps)
-
with
public NodeResources with(NodeResources.DiskSpeed diskSpeed)
-
with
public NodeResources with(NodeResources.StorageType storageType)
-
justNumbers
public NodeResources justNumbers()
Returns this with disk speed and storage type set to any
-
justNonNumbers
public NodeResources justNonNumbers()
Returns this with all numbers set to 0
-
subtract
public NodeResources subtract(NodeResources other)
-
add
public NodeResources add(NodeResources other)
-
satisfies
public boolean satisfies(NodeResources other)
Returns true if all the resources of this are the same or larger than the given resources
-
compatibleWith
public boolean compatibleWith(NodeResources other)
Returns true if all the resources of this are the same as or compatible with the given resources
-
unspecified
public static NodeResources unspecified()
-
isUnspecified
public boolean isUnspecified()
-
distanceTo
public double distanceTo(NodeResources other)
-
asOptional
public Optional<NodeResources> asOptional()
Returns this.isUnspecified() ? Optional.empty() : Optional.of(this)
-
fromLegacyName
public static NodeResources fromLegacyName(String name)
Create this from serial form.- Throws:
IllegalArgumentException
- if the given string cannot be parsed as a serial form of this
-
zero
public static NodeResources zero()
-
-