Package com.yahoo.vespa.model
Class VespaModel
- java.lang.Object
-
- com.yahoo.config.model.producer.AbstractConfigProducer<AbstractConfigProducer<?>>
-
- com.yahoo.config.model.producer.AbstractConfigProducerRoot
-
- com.yahoo.vespa.model.VespaModel
-
- All Implemented Interfaces:
com.yahoo.config.ConfigInstance.Producer
,com.yahoo.config.model.api.Model
,ConfigProducer
,ConfigProducerRoot
,java.io.Serializable
public final class VespaModel extends AbstractConfigProducerRoot implements java.io.Serializable, 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 and controller) are made available, but no additional config producers can be added.
- Author:
- gjoranv
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static java.util.logging.Logger
log
static java.lang.String
ROOT_CONFIGID
The config id for the root config producer-
Fields inherited from class com.yahoo.config.model.producer.AbstractConfigProducerRoot
id2producer
-
-
Constructor Summary
Constructors Constructor Description VespaModel(com.yahoo.config.application.api.ApplicationPackage app)
Creates a Vespa Model from internal model types onlyVespaModel(com.yahoo.config.application.api.ApplicationPackage app, ConfigModelRegistry configModelRegistry)
Constructs vespa model using config given in appVespaModel(ConfigModelRegistry configModelRegistry, DeployState deployState)
Constructs vespa model using config given in appVespaModel(DeployState deployState)
Creates a Vespa Model from internal model types only
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDescendant(java.lang.String configId, AbstractConfigProducer descendant)
Adds the descendant (at any depth level), so it can be looked up on configId in the Map.java.util.Set<com.yahoo.config.provision.ClusterSpec.Id>
allClusters()
Returns the id of all clusters in thisjava.util.Set<java.lang.String>
allConfigIds()
The set of all config ids presentjava.util.Set<com.yahoo.vespa.config.ConfigKey<?>>
allConfigsProduced()
com.yahoo.config.provision.AllocatedHosts
allocatedHosts()
boolean
allowModelVersionMismatch(java.time.Instant now)
com.yahoo.config.application.api.ApplicationPackage
applicationPackage()
Returns the application package owning thisprotected void
checkId(java.lang.String configId)
Throw if the config id does not exist in the model.ConfigModelRepo
configModelRepo()
Returns this root's model repositorystatic VespaModel
createIncomplete(DeployState deployState)
Creates a mutable model with no services instantiatedvoid
distributeFiles(com.yahoo.config.model.api.FileDistribution fileDistribution)
java.util.Set<com.yahoo.config.FileReference>
fileReferences()
Admin
getAdmin()
Returns the admin component of the vespamodel.Clients
getClients()
com.yahoo.config.ConfigInstance.Builder
getConfig(com.yahoo.config.ConfigInstance.Builder builder, java.lang.String configId)
Resolves config for a given config id and populates the given builder with the config.com.yahoo.vespa.config.ConfigPayload
getConfig(com.yahoo.vespa.config.ConfigKey configKey, com.yahoo.vespa.config.buildergen.ConfigDefinition targetDef)
Resolve config for a given key and config definitionstatic <CONFIGTYPE extends com.yahoo.config.ConfigInstance>
CONFIGTYPEgetConfig(java.lang.Class<CONFIGTYPE> configClass, ConfigProducer configProducer)
Populates an instance of configClass with config produced by configProducer.<CONFIGTYPE extends com.yahoo.config.ConfigInstance>
CONFIGTYPEgetConfig(java.lang.Class<CONFIGTYPE> clazz, java.lang.String configId)
Resolves config of the given type and config id, by first instantiating the correctConfigInstance.Builder
, callinggetConfig(com.yahoo.config.ConfigInstance.Builder, String)
.java.util.Set<java.lang.String>
getConfigIds()
java.util.Map<java.lang.String,ApplicationContainerCluster>
getContainerClusters()
Returns a map of container clusters by IDjava.util.Map<java.lang.String,ContentCluster>
getContentClusters()
Returns a map of content clusters by IDFileDistributionConfigProducer
getFileDistributionConfigProducer()
FileDistributor
getFileDistributor()
java.util.Set<com.yahoo.config.model.api.HostInfo>
getHosts()
Return a collection of all hostnames used in this applicationRouting
getRouting()
Returns the routing config model.java.util.List<AbstractSearchCluster>
getSearchClusters()
Returns all search clusters, both in Search and ContentApplicationConfigProducerRoot
getVespa()
Returns this models Vespa instanceHostSystem
hostSystem()
Returns the one and only HostSystem of this VespaModeljava.util.Map<java.lang.String,ConfigProducer>
id2producer()
Returns an unmodifiable view of the mapping of config id toConfigProducer
com.yahoo.config.model.api.Provisioned
provisioned()
If provisioning through the node repo, returns the provision requests issued during build of thisRankingConstants
rankingConstants()
Returns the global ranking constants of thisRankProfileList
rankProfileList()
Returns the global rank profiles as a rank profile listjava.util.List<ServiceCluster>
serviceClusters()
The clusters of application specific generic servicesboolean
skipOldConfigModels(java.time.Instant now)
com.yahoo.component.Version
version()
-
Methods inherited from class com.yahoo.config.model.producer.AbstractConfigProducerRoot
freezeModelTopology, getConfigProducer, getRoot, getService
-
Methods inherited from class com.yahoo.config.model.producer.AbstractConfigProducer
addChild, addConfigId, addDescendantService, addUserConfig, cascadeConfig, dump, getChildren, getChildrenByTypeRecursive, getConfigClassLoader, getConfigId, getDescendantServices, getMonitoringService, getParent, getSubId, getUserConfigs, mergeUserConfigs, removeChild, setParent, setUserConfigs, stateIsHosted, validate
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.yahoo.vespa.model.ConfigProducer
addUserConfig, cascadeConfig, dump, getChildren, getConfigId, getDescendantServices, getUserConfigs, validate
-
-
-
-
Field Detail
-
log
public static final java.util.logging.Logger log
-
ROOT_CONFIGID
public static final java.lang.String ROOT_CONFIGID
The config id for the root config producer- See Also:
- Constant Field Values
-
-
Constructor Detail
-
VespaModel
public VespaModel(com.yahoo.config.application.api.ApplicationPackage app) throws java.io.IOException, org.xml.sax.SAXException
Creates a Vespa Model from internal model types only- Throws:
java.io.IOException
org.xml.sax.SAXException
-
VespaModel
public VespaModel(DeployState deployState) throws java.io.IOException, org.xml.sax.SAXException
Creates a Vespa Model from internal model types only- Throws:
java.io.IOException
org.xml.sax.SAXException
-
VespaModel
public VespaModel(com.yahoo.config.application.api.ApplicationPackage app, ConfigModelRegistry configModelRegistry) throws java.io.IOException, org.xml.sax.SAXException
Constructs vespa model using config given in app- Parameters:
app
- the application to create a model fromconfigModelRegistry
- a registry of config model "main" classes which may be used to instantiate config models- Throws:
java.io.IOException
org.xml.sax.SAXException
-
VespaModel
public VespaModel(ConfigModelRegistry configModelRegistry, DeployState deployState) throws java.io.IOException, org.xml.sax.SAXException
Constructs vespa model using config given in app- Parameters:
configModelRegistry
- a registry of config model "main" classes which may be used to instantiate config modelsdeployState
- the global deploy state to use for this model.- Throws:
java.io.IOException
org.xml.sax.SAXException
-
-
Method Detail
-
applicationPackage
public com.yahoo.config.application.api.ApplicationPackage applicationPackage()
Returns the application package owning this
-
rankingConstants
public RankingConstants rankingConstants()
Returns the global ranking constants of this
-
createIncomplete
public static VespaModel createIncomplete(DeployState deployState) throws java.io.IOException, org.xml.sax.SAXException
Creates a mutable model with no services instantiated- Throws:
java.io.IOException
org.xml.sax.SAXException
-
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 interfaceConfigProducer
- Overrides:
hostSystem
in classAbstractConfigProducer<AbstractConfigProducer<?>>
-
getHosts
public java.util.Set<com.yahoo.config.model.api.HostInfo> getHosts()
Return a collection of all hostnames used in this application- Specified by:
getHosts
in interfacecom.yahoo.config.model.api.Model
-
getFileDistributor
public FileDistributor getFileDistributor()
- Specified by:
getFileDistributor
in interfaceConfigProducerRoot
-
fileReferences
public java.util.Set<com.yahoo.config.FileReference> fileReferences()
- Specified by:
fileReferences
in interfacecom.yahoo.config.model.api.Model
-
getVespa
public ApplicationConfigProducerRoot getVespa()
Returns this models Vespa instance
-
allowModelVersionMismatch
public boolean allowModelVersionMismatch(java.time.Instant now)
- Specified by:
allowModelVersionMismatch
in interfacecom.yahoo.config.model.api.Model
-
skipOldConfigModels
public boolean skipOldConfigModels(java.time.Instant now)
- Specified by:
skipOldConfigModels
in interfacecom.yahoo.config.model.api.Model
-
version
public com.yahoo.component.Version version()
- Specified by:
version
in interfacecom.yahoo.config.model.api.Model
-
getConfig
public <CONFIGTYPE extends com.yahoo.config.ConfigInstance> CONFIGTYPE getConfig(java.lang.Class<CONFIGTYPE> clazz, java.lang.String configId)
Resolves config of the given type and config id, by first instantiating the correctConfigInstance.Builder
, callinggetConfig(com.yahoo.config.ConfigInstance.Builder, String)
. The default values used will be those of the config types in the model.- Specified by:
getConfig
in interfaceConfigProducerRoot
- Parameters:
clazz
- the type of configconfigId
- the config id- Returns:
- a config instance of the given type
-
getConfig
public static <CONFIGTYPE extends com.yahoo.config.ConfigInstance> CONFIGTYPE getConfig(java.lang.Class<CONFIGTYPE> configClass, ConfigProducer configProducer)
Populates an instance of configClass with config produced by configProducer.
-
checkId
protected void checkId(java.lang.String configId)
Throw if the config id does not exist in the model.- Parameters:
configId
- a config id
-
getConfig
public com.yahoo.config.ConfigInstance.Builder getConfig(com.yahoo.config.ConfigInstance.Builder builder, java.lang.String configId)
Resolves config for a given config id and populates the given builder with the config.- Specified by:
getConfig
in interfaceConfigProducerRoot
- Parameters:
builder
- a configinstance builderconfigId
- the config id for the config client- Returns:
- the builder if a producer was found, and it did apply config, null otherwise
-
getConfig
public com.yahoo.vespa.config.ConfigPayload getConfig(com.yahoo.vespa.config.ConfigKey configKey, com.yahoo.vespa.config.buildergen.ConfigDefinition targetDef)
Resolve config for a given key and config definition- Specified by:
getConfig
in interfacecom.yahoo.config.model.api.Model
- Parameters:
configKey
- The key to resolve.targetDef
- The config definition to use for the schema- Returns:
- The payload as a list of strings
-
allConfigsProduced
public java.util.Set<com.yahoo.vespa.config.ConfigKey<?>> allConfigsProduced()
- Specified by:
allConfigsProduced
in interfacecom.yahoo.config.model.api.Model
-
allConfigIds
public java.util.Set<java.lang.String> allConfigIds()
The set of all config ids present- Specified by:
allConfigIds
in interfacecom.yahoo.config.model.api.Model
- Returns:
- set of config ids
-
distributeFiles
public void distributeFiles(com.yahoo.config.model.api.FileDistribution fileDistribution)
- Specified by:
distributeFiles
in interfacecom.yahoo.config.model.api.Model
-
allocatedHosts
public com.yahoo.config.provision.AllocatedHosts allocatedHosts()
- Specified by:
allocatedHosts
in interfacecom.yahoo.config.model.api.Model
-
getConfigIds
public java.util.Set<java.lang.String> getConfigIds()
- Specified by:
getConfigIds
in interfaceConfigProducerRoot
- 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 interfaceConfigProducerRoot
- Returns:
- Admin
-
addDescendant
public void addDescendant(java.lang.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 interfaceConfigProducerRoot
- Parameters:
configId
- the id to register with, not necessarily equal to descendant.getConfigId().descendant
- The configProducer descendant to add
-
getClients
public Clients getClients()
-
getSearchClusters
public java.util.List<AbstractSearchCluster> getSearchClusters()
Returns all search clusters, both in Search and Content
-
getContentClusters
public java.util.Map<java.lang.String,ContentCluster> getContentClusters()
Returns a map of content clusters by ID
-
getContainerClusters
public java.util.Map<java.lang.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 classAbstractConfigProducerRoot
-
serviceClusters
public java.util.List<ServiceCluster> serviceClusters()
The clusters of application specific generic services
-
id2producer
public java.util.Map<java.lang.String,ConfigProducer> id2producer()
Returns an unmodifiable view of the mapping of config id toConfigProducer
-
configModelRepo
public ConfigModelRepo configModelRepo()
Returns this root's model repository- Specified by:
configModelRepo
in classAbstractConfigProducerRoot
-
provisioned
public com.yahoo.config.model.api.Provisioned provisioned()
If provisioning through the node repo, returns the provision requests issued during build of this
-
allClusters
public java.util.Set<com.yahoo.config.provision.ClusterSpec.Id> allClusters()
Returns the id of all clusters in this
-
-