Class NodeResources


  • public class NodeResources
    extends java.lang.Object
    The node resources required by an application cluster
    Author:
    bratseth
    • 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)
    • Method Detail

      • vcpu

        public double vcpu()
      • memoryGb

        public double memoryGb()
      • diskGb

        public double diskGb()
      • bandwidthGbps

        public double bandwidthGbps()
      • cost

        public double cost()
        Returns the standard cost of these resources, in dollars per hour
      • withMemoryGb

        public NodeResources withMemoryGb​(double memoryGb)
      • withDiskGb

        public NodeResources withDiskGb​(double diskGb)
      • withBandwidthGbps

        public NodeResources withBandwidthGbps​(double bandwidthGbps)
      • 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
      • equals

        public boolean equals​(java.lang.Object o)
        Overrides:
        equals in class java.lang.Object
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class java.lang.Object
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • 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
      • isUnspecified

        public boolean isUnspecified()
      • asOptional

        public java.util.Optional<NodeResources> asOptional()
        Returns this.isUnspecified() ? Optional.empty() : Optional.of(this)
      • fromLegacyName

        public static NodeResources fromLegacyName​(java.lang.String name)
        Create this from serial form.
        Throws:
        java.lang.IllegalArgumentException - if the given string cannot be parsed as a serial form of this