Package com.yahoo.vespa.model
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 Summary
FieldsModifier and TypeFieldDescriptionstatic final Loggerstatic final StringThe config id for the root config producerFields inherited from class com.yahoo.config.model.producer.AbstractConfigProducerRoot
id2producer -
Constructor Summary
ConstructorsConstructorDescriptionVespaModel(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
Modifier and TypeMethodDescriptionvoidaddDescendant(String configId, AnyConfigProducer descendant) Adds the descendant (at any depth level), so it can be looked up on configId in the Map.Set<com.yahoo.config.provision.ClusterSpec>Returns the spedc of all clusters in thisThe set of all config ids presentSet<com.yahoo.vespa.config.ConfigKey<?>>com.yahoo.config.provision.AllocatedHostsbooleanSet<com.yahoo.config.model.api.ApplicationClusterInfo>com.yahoo.config.application.api.ApplicationPackageReturns the application package owning thisReturns this root's model repositorystatic VespaModelcreateIncomplete(DeployState deployState) Creates a mutable model with no services instantiatedSet<com.yahoo.config.FileReference>getAdmin()Returns the admin component of the vespamodel.com.yahoo.config.ConfigInstance.BuilderResolves config for a given config id and populates the given builder with the config.static <CONFIGTYPE extends com.yahoo.config.ConfigInstance>
CONFIGTYPEgetConfig(Class<CONFIGTYPE> configClass, ConfigProducer configProducer) Populates an instance of configClass with config produced by configProducer.<CONFIGTYPE extends com.yahoo.config.ConfigInstance>
CONFIGTYPEResolves config of the given type and config id, by first instantiating the correctConfigInstance.Builder, callinggetConfig(com.yahoo.config.ConfigInstance.Builder, String).com.yahoo.config.ConfigInstance.BuildergetConfigInstance(com.yahoo.vespa.config.ConfigKey<?> configKey, com.yahoo.vespa.config.buildergen.ConfigDefinition targetDef) Resolve config for a given key and config definitionReturns a map of container clusters by IDReturns a map of content clusters by IDSet<com.yahoo.config.model.api.HostInfo>getHosts()Return a collection of all hostnames used in this applicationReturns the routing config model.getVespa()Returns this models Vespa instanceReturns the one and only HostSystem of this VespaModelReturns an unmodifiable view of the mapping of config id toConfigProducercom.yahoo.config.model.api.ProvisionedIf provisioning through the node repo, returns the provision requests issued during build of thisReturns the global rank profiles as a rank profile listbooleancom.yahoo.component.Versionversion()com.yahoo.component.VersionMethods inherited from class com.yahoo.config.model.producer.AbstractConfigProducerRoot
freezeModelTopology, getConfigProducer, getRoot, getServiceMethods inherited from class com.yahoo.config.model.producer.TreeConfigProducer
addChild, addDescendantService, getChildren, getChildrenByTypeRecursive, getConfigClassLoader, getDescendantServices, removeChild, validateMethods inherited from class com.yahoo.config.model.producer.AnyConfigProducer
addConfigId, addUserConfig, cascadeConfig, currentConfigId, findInheritedClassLoader, getConfigId, getMonitoringService, getParent, getSubId, getUserConfigs, mergeUserConfigs, remove, setParent, setUserConfigs, stateIsHostedMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.yahoo.vespa.model.ConfigProducer
addUserConfig, cascadeConfig, dump, getChildren, getConfigId, getDescendantServices, getUserConfigs, validate
-
Field Details
-
log
-
ROOT_CONFIGID
The config id for the root config producer- See Also:
-
-
Constructor Details
-
VespaModel
public VespaModel(com.yahoo.config.application.api.ApplicationPackage app) throws IOException, SAXException Creates a Vespa Model from internal model types only- Throws:
IOExceptionSAXException
-
VespaModel
Creates a Vespa Model from internal model types only- Throws:
IOExceptionSAXException
-
VespaModel
public VespaModel(com.yahoo.config.application.api.ApplicationPackage app, ConfigModelRegistry configModelRegistry) throws IOException, 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:
IOExceptionSAXException
-
VespaModel
public VespaModel(ConfigModelRegistry configModelRegistry, DeployState deployState) throws IOException, 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:
IOExceptionSAXException
-
-
Method Details
-
documentTypesByCluster
- Specified by:
documentTypesByClusterin interfacecom.yahoo.config.model.api.Model
-
indexedDocumentTypesByCluster
- Specified by:
indexedDocumentTypesByClusterin interfacecom.yahoo.config.model.api.Model
-
applicationPackage
public com.yahoo.config.application.api.ApplicationPackage applicationPackage()Returns the application package owning this -
createIncomplete
Creates a mutable model with no services instantiated- Throws:
IOException
-
rankProfileList
Returns the global rank profiles as a rank profile list -
hostSystem
Returns the one and only HostSystem of this VespaModel- Specified by:
hostSystemin interfaceConfigProducer- Overrides:
hostSystemin classAnyConfigProducer
-
getHosts
Return a collection of all hostnames used in this application- Specified by:
getHostsin interfacecom.yahoo.config.model.api.Model
-
fileReferences
- Specified by:
fileReferencesin interfacecom.yahoo.config.model.api.Model
-
getVespa
Returns this models Vespa instance -
allowModelVersionMismatch
- Specified by:
allowModelVersionMismatchin interfacecom.yahoo.config.model.api.Model
-
skipOldConfigModels
- Specified by:
skipOldConfigModelsin interfacecom.yahoo.config.model.api.Model
-
version
public com.yahoo.component.Version version()- Specified by:
versionin interfacecom.yahoo.config.model.api.Model
-
wantedNodeVersion
public com.yahoo.component.Version wantedNodeVersion()- Specified by:
wantedNodeVersionin interfacecom.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 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:
getConfigin 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(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:
getConfigin 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
-
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:
getConfigInstancein interfacecom.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
- Specified by:
allConfigsProducedin interfacecom.yahoo.config.model.api.Model
-
allConfigIds
The set of all config ids present- Specified by:
allConfigIdsin interfacecom.yahoo.config.model.api.Model- Returns:
- set of config ids
-
allocatedHosts
public com.yahoo.config.provision.AllocatedHosts allocatedHosts()- Specified by:
allocatedHostsin interfacecom.yahoo.config.model.api.Model
-
getConfigIds
- Specified by:
getConfigIdsin interfaceConfigProducerRoot- Returns:
- an unmodifiable copy of the set of configIds in this VespaModel.
-
getAdmin
Returns the admin component of the vespamodel.- Specified by:
getAdminin interfaceConfigProducerRoot- Returns:
- Admin
-
addDescendant
Adds the descendant (at any depth level), so it can be looked up on configId in the Map.- Specified by:
addDescendantin interfaceConfigProducerRoot- Parameters:
configId- the id to register with, not necessarily equal to descendant.getConfigId().descendant- The configProducer descendant to add
-
getSearchClusters
-
getContentClusters
Returns a map of content clusters by ID -
getContainerClusters
Returns a map of container clusters by ID -
getRouting
Returns the routing config model. This might be null. -
id2producer
Returns an unmodifiable view of the mapping of config id toConfigProducer -
configModelRepo
Returns this root's model repository- Specified by:
configModelRepoin 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- Specified by:
provisionedin interfacecom.yahoo.config.model.api.Model
-
allClusters
Returns the spedc of all clusters in this -
applicationClusterInfo
- Specified by:
applicationClusterInfoin interfacecom.yahoo.config.model.api.Model
-