Class InMemoryProvisioner

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

    public class InMemoryProvisioner
    extends 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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static com.yahoo.config.provision.NodeResources defaultResources  
    • Constructor Summary

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

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      com.yahoo.config.provision.HostSpec allocateHost​(String alias)  
      Map<com.yahoo.config.provision.ClusterSpec,​List<com.yahoo.config.provision.HostSpec>> allocations()
      Returns the current allocations of this as a mutable map
      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)  
      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
    • Field Detail

      • defaultResources

        public static final com.yahoo.config.provision.NodeResources defaultResources
    • Constructor Detail

      • InMemoryProvisioner

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

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

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

        public InMemoryProvisioner​(boolean failOnOutOfCapacity,
                                   boolean sharedHosts,
                                   List<String> hosts)
        Creates this with a set of host names of the flavor 'default'
      • InMemoryProvisioner

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

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

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

      • allocations

        public Map<com.yahoo.config.provision.ClusterSpec,​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​(String alias)
        Specified by:
        allocateHost in interface com.yahoo.config.model.api.HostProvisioner
      • prepare

        public 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 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