Class InMemoryProvisioner

java.lang.Object
com.yahoo.config.model.provision.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 final com.yahoo.config.provision.NodeResources
     
  • 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

    Modifier and Type
    Method
    Description
    com.yahoo.config.provision.HostSpec
     
    Map<com.yahoo.config.provision.ClusterSpec,List<com.yahoo.config.provision.HostSpec>>
    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)
     
    Set<com.yahoo.config.provision.ClusterSpec>
     
    setEnvironment(com.yahoo.config.provision.Environment environment)
    May affect e.g.
    com.yahoo.config.model.api.Provisioned
    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
  • Field Details

    • defaultResources

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

    • 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 Details

    • setEnvironment

      public InMemoryProvisioner setEnvironment(com.yahoo.config.provision.Environment environment)
      May affect e.g. the number of nodes/cluster.
    • 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
    • provisionedClusters

      public Set<com.yahoo.config.provision.ClusterSpec> provisionedClusters()