Class InMemoryProvisioner

  • All Implemented Interfaces:
    com.yahoo.config.model.api.HostProvisioner

    public class InMemoryProvisioner
    extends java.lang.Object
    implements com.yahoo.config.model.api.HostProvisioner
    In memory host provisioner for testing only. NB! ATM cannot be reused after allocate has been called.
    Author:
    hmusum, bratseth
    • Constructor Summary

      Constructors 
      Constructor Description
      InMemoryProvisioner​(boolean failOnOutOfCapacity, java.lang.String... hosts)
      Creates this with a set of host names of the flavor 'default'
      InMemoryProvisioner​(int nodeCount)
      Creates this with a number of nodes with resources 1, 3, 9, 1
      InMemoryProvisioner​(int nodeCount, com.yahoo.config.provision.NodeResources resources)
      Creates this with a number of nodes with given resources
      InMemoryProvisioner​(Hosts hosts, boolean failOnOutOfCapacity, int startIndexForClusters, java.lang.String... retiredHostNames)
      Creates this with a set of hosts of the flavor 'default'
      InMemoryProvisioner​(Hosts hosts, boolean failOnOutOfCapacity, java.lang.String... retiredHostNames)
      Creates this with a set of hosts of the flavor 'default'
      InMemoryProvisioner​(java.util.Map<com.yahoo.config.provision.NodeResources,​java.util.Collection<Host>> hosts, boolean failOnOutOfCapacity, boolean useMaxResources, int startIndexForClusters, java.lang.String... retiredHostNames)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.yahoo.config.provision.HostSpec allocateHost​(java.lang.String alias)  
      java.util.Map<com.yahoo.config.provision.ClusterSpec,​java.util.List<com.yahoo.config.provision.HostSpec>> allocations()
      Returns the current allocations of this as a mutable map
      java.util.List<com.yahoo.config.provision.HostSpec> prepare​(com.yahoo.config.provision.ClusterSpec cluster, com.yahoo.config.provision.Capacity requested, com.yahoo.config.provision.ProvisionLogger logger)  
      java.util.List<com.yahoo.config.provision.HostSpec> prepare​(com.yahoo.config.provision.ClusterSpec cluster, com.yahoo.config.provision.ClusterResources requested, boolean required, boolean canFail)  
      com.yahoo.config.model.api.Provisioned startProvisionedRecording()
      Create a new provisioned instance to record provision requests to this and returns it
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InMemoryProvisioner

        public InMemoryProvisioner​(int nodeCount)
        Creates this with a number of nodes with resources 1, 3, 9, 1
      • InMemoryProvisioner

        public InMemoryProvisioner​(int nodeCount,
                                   com.yahoo.config.provision.NodeResources resources)
        Creates this with a number of nodes with given resources
      • InMemoryProvisioner

        public InMemoryProvisioner​(boolean failOnOutOfCapacity,
                                   java.lang.String... hosts)
        Creates this with a set of host names of the flavor 'default'
      • InMemoryProvisioner

        public InMemoryProvisioner​(Hosts hosts,
                                   boolean failOnOutOfCapacity,
                                   java.lang.String... retiredHostNames)
        Creates this with a set of hosts of the flavor 'default'
      • InMemoryProvisioner

        public InMemoryProvisioner​(Hosts hosts,
                                   boolean failOnOutOfCapacity,
                                   int startIndexForClusters,
                                   java.lang.String... retiredHostNames)
        Creates this with a set of hosts of the flavor 'default'
      • InMemoryProvisioner

        public InMemoryProvisioner​(java.util.Map<com.yahoo.config.provision.NodeResources,​java.util.Collection<Host>> hosts,
                                   boolean failOnOutOfCapacity,
                                   boolean useMaxResources,
                                   int startIndexForClusters,
                                   java.lang.String... retiredHostNames)
    • Method Detail

      • allocations

        public java.util.Map<com.yahoo.config.provision.ClusterSpec,​java.util.List<com.yahoo.config.provision.HostSpec>> allocations()
        Returns the current allocations of this as a mutable map
      • allocateHost

        public com.yahoo.config.provision.HostSpec allocateHost​(java.lang.String alias)
        Specified by:
        allocateHost in interface com.yahoo.config.model.api.HostProvisioner
      • prepare

        public java.util.List<com.yahoo.config.provision.HostSpec> prepare​(com.yahoo.config.provision.ClusterSpec cluster,
                                                                           com.yahoo.config.provision.Capacity requested,
                                                                           com.yahoo.config.provision.ProvisionLogger logger)
        Specified by:
        prepare in interface com.yahoo.config.model.api.HostProvisioner
      • prepare

        public java.util.List<com.yahoo.config.provision.HostSpec> prepare​(com.yahoo.config.provision.ClusterSpec cluster,
                                                                           com.yahoo.config.provision.ClusterResources requested,
                                                                           boolean required,
                                                                           boolean canFail)
      • startProvisionedRecording

        public com.yahoo.config.model.api.Provisioned startProvisionedRecording()
        Create a new provisioned instance to record provision requests to this and returns it