summaryrefslogtreecommitdiffstats
path: root/config-model
diff options
context:
space:
mode:
authorHarald Musum <musum@yahooinc.com>2024-03-07 07:59:58 +0100
committerHarald Musum <musum@yahooinc.com>2024-03-07 07:59:58 +0100
commit72aab11e0150cfff46a871245e3bc644676de2a1 (patch)
treefa7a3cc37b802911844f6828fb9b0c9b4c8a7fe9 /config-model
parent296c4a2be1e8a0d521c036eb30a709364ceacc57 (diff)
GC code handling unsupported 'vespa' and 'http' provider type
Diffstat (limited to 'config-model')
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomProviderBuilder.java83
-rw-r--r--config-model/src/main/resources/schema/federation.rnc16
-rw-r--r--config-model/src/test/schema-test-files/services.xml6
-rw-r--r--config-model/src/test/schema-test-files/standalone-container.xml6
4 files changed, 3 insertions, 108 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomProviderBuilder.java b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomProviderBuilder.java
index 43318bc8591..9f981709908 100644
--- a/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomProviderBuilder.java
+++ b/config-model/src/main/java/com/yahoo/vespa/model/builder/xml/dom/chains/search/DomProviderBuilder.java
@@ -1,7 +1,6 @@
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.model.builder.xml.dom.chains.search;
-import com.yahoo.component.ComponentId;
import com.yahoo.component.chain.model.ChainSpecification;
import com.yahoo.config.model.deploy.DeployState;
import com.yahoo.config.model.producer.AnyConfigProducer;
@@ -15,6 +14,7 @@ import com.yahoo.vespa.model.container.search.searchchain.LocalProvider;
import com.yahoo.vespa.model.container.search.searchchain.Provider;
import com.yahoo.vespa.model.container.search.searchchain.Source;
import org.w3c.dom.Element;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
@@ -36,25 +36,11 @@ public class DomProviderBuilder extends DomGenericTargetBuilder<Provider> {
private static class ProviderReader {
final String type;
- final String path;
- final Double cacheWeight;
- final Integer retries;
- final Double readTimeout;
- final Double connectionTimeout;
- final Double connectionPoolTimeout;
final String clusterName;
- final List<Node> nodes;
ProviderReader(Element providerElement) {
type = readType(providerElement);
- path = readPath(providerElement);
- cacheWeight = readCacheWeight(providerElement);
clusterName = readCluster(providerElement);
- readTimeout = readReadTimeout(providerElement);
- connectionTimeout = readConnectionTimeout(providerElement);
- connectionPoolTimeout = readConnectionPoolTimeout(providerElement);
- retries = readRetries(providerElement);
- nodes = readNodes(providerElement);
}
private String getAttributeOrNull(Element element, String name) {
@@ -62,60 +48,10 @@ public class DomProviderBuilder extends DomGenericTargetBuilder<Provider> {
return value.isEmpty() ? null : value;
}
- private String readPath(Element providerElement) {
- return getAttributeOrNull(providerElement, "path");
- }
-
private String readCluster(Element providerElement) {
return getAttributeOrNull(providerElement, "cluster");
}
- private Double readCacheWeight(Element providerElement) {
- String cacheWeightString = getAttributeOrNull(providerElement, "cacheweight");
- return (cacheWeightString == null)? null : Double.parseDouble(cacheWeightString);
- }
-
- private Integer readRetries(Element providerElement) {
- String retriesString = getAttributeOrNull(providerElement, "retries");
- return (retriesString == null) ? null : Integer.parseInt(retriesString);
- }
-
- private Double readReadTimeout(Element providerElement) {
- String timeoutString = getAttributeOrNull(providerElement, "readtimeout");
- return (timeoutString == null) ? null : TimeParser.seconds(timeoutString);
- }
-
- private Double readConnectionTimeout(Element providerElement) {
- String timeoutString = getAttributeOrNull(providerElement, "connectiontimeout");
- return (timeoutString == null) ? null : TimeParser.seconds(timeoutString);
- }
-
- private Double readConnectionPoolTimeout(Element providerElement) {
- String timeoutString = getAttributeOrNull(providerElement, "connectionpooltimeout");
- return (timeoutString == null) ? null : TimeParser.seconds(timeoutString);
- }
-
- private List<Node> readNodes(Element providerElement) {
- Element nodesSpec = XML.getChild(providerElement, "nodes");
- if (nodesSpec == null) {
- return null;
- }
-
- List<Node> nodes = new ArrayList<>();
- for (Element nodeSpec : XML.getChildren(nodesSpec, "node")) {
- nodes.add(readNode(nodeSpec));
- }
- return nodes;
- }
-
- private Node readNode(Element nodeElement) {
- String host = getAttributeOrNull(nodeElement, "host");
- // The direct calls to parse methods below works because the schema
- // guarantees us no null references
- int port = Integer.parseInt(getAttributeOrNull(nodeElement, "port"));
- return new Node(host, port);
- }
-
private String readType(Element providerElement) {
return getAttributeOrNull(providerElement, "type");
}
@@ -171,15 +107,6 @@ public class DomProviderBuilder extends DomGenericTargetBuilder<Provider> {
ProviderReader providerReader,
FederationOptions federationOptions) {
try {
- ensureEmpty(specWithoutInnerSearchers.componentId,
- providerReader.cacheWeight,
- providerReader.path,
- providerReader.nodes,
- providerReader.readTimeout,
- providerReader.connectionTimeout,
- providerReader.connectionPoolTimeout,
- providerReader.retries);
-
return new LocalProvider(specWithoutInnerSearchers,
federationOptions,
new LocalProviderSpec(providerReader.clusterName));
@@ -188,14 +115,6 @@ public class DomProviderBuilder extends DomGenericTargetBuilder<Provider> {
}
}
- private void ensureEmpty(ComponentId componentId, Object... objects) {
- for (Object object : objects) {
- if (object != null) {
- throw new IllegalArgumentException("Invalid provider option in provider '" + componentId + "': value='" + object + "'");
- }
- }
- }
-
public static class Node {
public final String host;
diff --git a/config-model/src/main/resources/schema/federation.rnc b/config-model/src/main/resources/schema/federation.rnc
index a2ddff55efc..d0e6287f7c9 100644
--- a/config-model/src/main/resources/schema/federation.rnc
+++ b/config-model/src/main/resources/schema/federation.rnc
@@ -17,25 +17,9 @@ Provider =
attribute type { xsd:string }? &
attribute cluster { xsd:string }? &
- HttpProviderSearcherOptions &
-
Source*
}
-HttpProviderSearcherOptions =
- attribute cacheweight { xsd:float { minInclusive = "0" } }? &
- attribute path { xsd:string }? &
- attribute readtimeout { xsd:string { pattern = "\d+(\.\d*)?\s*m?s" } }? &
- attribute connectiontimeout { xsd:string { pattern = "\d+(\.\d*)?\s*m?s" } }? &
- attribute connectionpooltimeout { xsd:string { pattern = "\d+(\.\d*)?\s*m?s" } }? &
- attribute retries { xsd:int }? &
- element nodes {
- element node {
- attribute host { xsd:string } &
- attribute port { xsd:int }
- }+
- } ?
-
FederationOptions =
element federationoptions {
attribute optional { xsd:boolean }? &
diff --git a/config-model/src/test/schema-test-files/services.xml b/config-model/src/test/schema-test-files/services.xml
index d62d59fe84c..63b05a0ddfe 100644
--- a/config-model/src/test/schema-test-files/services.xml
+++ b/config-model/src/test/schema-test-files/services.xml
@@ -148,11 +148,7 @@
<searcher id='inner-searcher' />
</chain>
- <provider id='yca-provider' type='vespa'>
- <nodes>
- <node host='sourcehost' port='12'/>
- </nodes>
- </provider>
+ <provider id='provider' type='local' cluster='foo'/>
<chain id="parentchain" searchers="one two">
<searcher id="three" />
diff --git a/config-model/src/test/schema-test-files/standalone-container.xml b/config-model/src/test/schema-test-files/standalone-container.xml
index 62caf586e5f..ee22095b4fe 100644
--- a/config-model/src/test/schema-test-files/standalone-container.xml
+++ b/config-model/src/test/schema-test-files/standalone-container.xml
@@ -55,11 +55,7 @@
<searcher id='inner-searcher' />
</chain>
- <provider id='yca-provider' type='vespa'>
- <nodes>
- <node host='sourcehost' port='12'/>
- </nodes>
- </provider>
+ <provider id='provider' type='local' cluster='foo'/>
<chain id="parentchain" searchers="one two">
<searcher id="three" />