Class VespaModel

All Implemented Interfaces:
com.yahoo.config.ConfigInstance.Producer, com.yahoo.config.model.api.Model, ConfigProducer, ConfigProducerRoot, Serializable

public final class VespaModel extends AbstractConfigProducerRoot implements com.yahoo.config.model.api.Model

The root ConfigProducer node for all Vespa systems (there is currently only one). The main class for building the Vespa model.

The vespa model starts in an unfrozen state, where children can be added freely, but no structure dependent information can be used. When frozen, structure dependent information (such as config id) are made available, but no additional config producers can be added.

Author:
gjoranv
See Also:
  • Field Details

    • log

      public static final Logger log
    • ROOT_CONFIGID

      public static final String ROOT_CONFIGID
      The config id for the root config producer
      See Also:
  • Constructor Details

  • Method Details

    • documentTypesByCluster

      public Map<String,Set<String>> documentTypesByCluster()
      Specified by:
      documentTypesByCluster in interface com.yahoo.config.model.api.Model
    • indexedDocumentTypesByCluster

      public Map<String,Set<String>> indexedDocumentTypesByCluster()
      Specified by:
      indexedDocumentTypesByCluster in interface com.yahoo.config.model.api.Model
    • applicationPackage

      public com.yahoo.config.application.api.ApplicationPackage applicationPackage()
      Returns the application package owning this
    • createIncomplete

      public static VespaModel createIncomplete(DeployState deployState) throws IOException
      Creates a mutable model with no services instantiated
      Throws:
      IOException
    • rankProfileList

      public RankProfileList rankProfileList()
      Returns the global rank profiles as a rank profile list
    • hostSystem

      public HostSystem hostSystem()
      Returns the one and only HostSystem of this VespaModel
      Specified by:
      hostSystem in interface ConfigProducer
      Overrides:
      hostSystem in class AbstractConfigProducer<AbstractConfigProducer<?>>
    • getHosts

      public Set<com.yahoo.config.model.api.HostInfo> getHosts()
      Return a collection of all hostnames used in this application
      Specified by:
      getHosts in interface com.yahoo.config.model.api.Model
    • fileReferences

      public Set<com.yahoo.config.FileReference> fileReferences()
      Specified by:
      fileReferences in interface com.yahoo.config.model.api.Model
    • getVespa

      public ApplicationConfigProducerRoot getVespa()
      Returns this models Vespa instance
    • allowModelVersionMismatch

      public boolean allowModelVersionMismatch(Instant now)
      Specified by:
      allowModelVersionMismatch in interface com.yahoo.config.model.api.Model
    • skipOldConfigModels

      public boolean skipOldConfigModels(Instant now)
      Specified by:
      skipOldConfigModels in interface com.yahoo.config.model.api.Model
    • version

      public com.yahoo.component.Version version()
      Specified by:
      version in interface com.yahoo.config.model.api.Model
    • wantedNodeVersion

      public com.yahoo.component.Version wantedNodeVersion()
      Specified by:
      wantedNodeVersion in interface com.yahoo.config.model.api.Model
    • getConfig

      public <CONFIGTYPE extends com.yahoo.config.ConfigInstance> CONFIGTYPE getConfig(Class<CONFIGTYPE> clazz, String configId)
      Resolves config of the given type and config id, by first instantiating the correct ConfigInstance.Builder, calling getConfig(com.yahoo.config.ConfigInstance.Builder, String). The default values used will be those of the config types in the model.
      Specified by:
      getConfig in interface ConfigProducerRoot
      Parameters:
      clazz - the type of config
      configId - the config id
      Returns:
      a config instance of the given type
    • getConfig

      public static <CONFIGTYPE extends com.yahoo.config.ConfigInstance> CONFIGTYPE getConfig(Class<CONFIGTYPE> configClass, ConfigProducer configProducer)
      Populates an instance of configClass with config produced by configProducer.
    • getConfig

      public com.yahoo.config.ConfigInstance.Builder getConfig(com.yahoo.config.ConfigInstance.Builder builder, String configId)
      Resolves config for a given config id and populates the given builder with the config.
      Specified by:
      getConfig in interface ConfigProducerRoot
      Parameters:
      builder - a configinstance builder
      configId - the config id for the config client
      Returns:
      the builder if a producer was found, and it did apply config, null otherwise
    • getConfigInstance

      public com.yahoo.config.ConfigInstance.Builder getConfigInstance(com.yahoo.vespa.config.ConfigKey<?> configKey, com.yahoo.vespa.config.buildergen.ConfigDefinition targetDef)
      Resolve config for a given key and config definition
      Specified by:
      getConfigInstance in interface com.yahoo.config.model.api.Model
      Parameters:
      configKey - the key to resolve.
      targetDef - the config definition to use for the schema
      Returns:
      the resolved config instance
    • allConfigsProduced

      public Set<com.yahoo.vespa.config.ConfigKey<?>> allConfigsProduced()
      Specified by:
      allConfigsProduced in interface com.yahoo.config.model.api.Model
    • allConfigIds

      public Set<String> allConfigIds()
      The set of all config ids present
      Specified by:
      allConfigIds in interface com.yahoo.config.model.api.Model
      Returns:
      set of config ids
    • allocatedHosts

      public com.yahoo.config.provision.AllocatedHosts allocatedHosts()
      Specified by:
      allocatedHosts in interface com.yahoo.config.model.api.Model
    • getConfigIds

      public Set<String> getConfigIds()
      Specified by:
      getConfigIds in interface ConfigProducerRoot
      Returns:
      an unmodifiable copy of the set of configIds in this VespaModel.
    • getAdmin

      public Admin getAdmin()
      Returns the admin component of the vespamodel.
      Specified by:
      getAdmin in interface ConfigProducerRoot
      Returns:
      Admin
    • addDescendant

      public void addDescendant(String configId, AbstractConfigProducer<?> descendant)
      Adds the descendant (at any depth level), so it can be looked up on configId in the Map.
      Specified by:
      addDescendant in interface ConfigProducerRoot
      Parameters:
      configId - the id to register with, not necessarily equal to descendant.getConfigId().
      descendant - The configProducer descendant to add
    • getSearchClusters

      public List<SearchCluster> getSearchClusters()
    • getContentClusters

      public Map<String,ContentCluster> getContentClusters()
      Returns a map of content clusters by ID
    • getContainerClusters

      public Map<String,ApplicationContainerCluster> getContainerClusters()
      Returns a map of container clusters by ID
    • getRouting

      public Routing getRouting()
      Returns the routing config model. This might be null.
    • getFileDistributionConfigProducer

      public FileDistributionConfigProducer getFileDistributionConfigProducer()
      Specified by:
      getFileDistributionConfigProducer in class AbstractConfigProducerRoot
    • id2producer

      public Map<String,ConfigProducer> id2producer()
      Returns an unmodifiable view of the mapping of config id to ConfigProducer
    • configModelRepo

      public ConfigModelRepo configModelRepo()
      Returns this root's model repository
      Specified by:
      configModelRepo in class AbstractConfigProducerRoot
    • provisioned

      public com.yahoo.config.model.api.Provisioned provisioned()
      If provisioning through the node repo, returns the provision requests issued during build of this
      Specified by:
      provisioned in interface com.yahoo.config.model.api.Model
    • allClusters

      public Set<com.yahoo.config.provision.ClusterSpec.Id> allClusters()
      Returns the id of all clusters in this
    • applicationClusterInfo

      public Set<com.yahoo.config.model.api.ApplicationClusterInfo> applicationClusterInfo()
      Specified by:
      applicationClusterInfo in interface com.yahoo.config.model.api.Model