Class HostResource

  • All Implemented Interfaces:
    java.lang.Comparable<HostResource>

    public class HostResource
    extends java.lang.Object
    implements java.lang.Comparable<HostResource>
    A host representation. The identity of this is the identity of its Host. TODO: Merge with Host Host resources are ordered by their host order.
    Author:
    Ulf Lilleengen
    • Constructor Detail

      • HostResource

        public HostResource​(Host host)
        Create a new HostResource bound to a specific Host.
        Parameters:
        host - Host object to bind to.
      • HostResource

        public HostResource​(Host host,
                            com.yahoo.config.provision.HostSpec spec)
    • Method Detail

      • getHost

        public Host getHost()
        Return the currently bounded Host.
        Returns:
        the Host if bound, null if not.
      • spec

        public com.yahoo.config.provision.HostSpec spec()
      • getService

        public Service getService​(java.lang.String sentinelName)
        Returns the service with the given "sentinel name" on this Host, or null if the name does not match any service.
        Parameters:
        sentinelName - the sentinel name of the service we want to return
        Returns:
        the service with the given sentinel name
      • getServices

        public java.util.List<Service> getServices()
        Returns a List of all services running on this Host.
      • getHostInfo

        public com.yahoo.config.model.api.HostInfo getHostInfo()
      • getFlavor

        public java.util.Optional<com.yahoo.config.provision.Flavor> getFlavor()
        Returns the flavor of this resource. Empty for self-hosted Vespa.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • getHostname

        public java.lang.String getHostname()
      • hashCode

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

        public boolean equals​(java.lang.Object other)
        Overrides:
        equals in class java.lang.Object
      • compareTo

        public int compareTo​(HostResource other)
        Specified by:
        compareTo in interface java.lang.Comparable<HostResource>
      • comparePrimarilyByIndexTo

        public int comparePrimarilyByIndexTo​(HostResource other)
        Compares by the index of the primary membership, if both hosts are members in at least one cluster at this time. Compare by hostname otherwise.