From ab0dfd64dfdd3889959d8459cc9fb0c320ecf047 Mon Sep 17 00:00:00 2001 From: Martin Polden Date: Fri, 28 Feb 2020 10:41:01 +0100 Subject: Remove RoutingGenerator --- .../api/integration/ServiceRegistry.java | 4 -- .../api/integration/routing/RoutingEndpoint.java | 60 ---------------------- .../api/integration/routing/RoutingGenerator.java | 27 ---------- .../integration/routing/RoutingGeneratorMock.java | 45 ---------------- 4 files changed, 136 deletions(-) delete mode 100644 controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingEndpoint.java delete mode 100644 controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGenerator.java delete mode 100644 controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java (limited to 'controller-api') diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java index 978a00fbccf..ca939023245 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/ServiceRegistry.java @@ -20,7 +20,6 @@ import com.yahoo.vespa.hosted.controller.api.integration.resource.CostReportCons import com.yahoo.vespa.hosted.controller.api.integration.resource.MeteringClient; import com.yahoo.vespa.hosted.controller.api.integration.resource.TenantCost; import com.yahoo.vespa.hosted.controller.api.integration.routing.GlobalRoutingService; -import com.yahoo.vespa.hosted.controller.api.integration.routing.RoutingGenerator; import com.yahoo.vespa.hosted.controller.api.integration.zone.ZoneRegistry; import java.time.Clock; @@ -41,9 +40,6 @@ public interface ServiceRegistry { GlobalRoutingService globalRoutingService(); - // TODO(mpolden): Remove - RoutingGenerator routingGenerator(); - Mailer mailer(); EndpointCertificateProvider endpointCertificateProvider(); diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingEndpoint.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingEndpoint.java deleted file mode 100644 index c0ccd0722f3..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingEndpoint.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.api.integration.routing; - -import java.util.Objects; - -/** - * @author smorgrav - */ -// TODO(mpolden): Remove together with RoutingGenerator and its implementations -public class RoutingEndpoint { - - private final boolean isGlobal; - private final String endpoint; - private final String hostname; - private final String upstreamName; - - public RoutingEndpoint(String endpoint, String hostname, boolean isGlobal, String upstreamName) { - this.endpoint = endpoint; - this.hostname = hostname; - this.isGlobal = isGlobal; - this.upstreamName = upstreamName; - } - - /** Whether this is a global endpoint */ - public boolean isGlobal() { - return isGlobal; - } - - /** URL for this endpoint */ - public String endpoint() { - return endpoint; - } - - /** First hostname for an upstream behind this endpoint */ - public String hostname() { - return hostname; - } - - /** The upstream name of this endpoint */ - public String upstreamName() { - return upstreamName; - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (o == null || getClass() != o.getClass()) return false; - RoutingEndpoint that = (RoutingEndpoint) o; - return isGlobal == that.isGlobal && - endpoint.equals(that.endpoint) && - hostname.equals(that.hostname) && - upstreamName.equals(that.upstreamName); - } - - @Override - public int hashCode() { - return Objects.hash(isGlobal, endpoint, hostname, upstreamName); - } - -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGenerator.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGenerator.java deleted file mode 100644 index 8150a99979e..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGenerator.java +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.api.integration.routing; - -import com.yahoo.config.provision.ClusterSpec; -import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; - -import java.net.URI; -import java.util.List; -import java.util.Map; - -/** - * @author bratseth - * @author smorgrav - */ -// TODO(mpolden): Remove -public interface RoutingGenerator { - - /** - * @param deploymentId Specifying an application in a zone - * @return List of endpoints for that deploymentId - */ - List endpoints(DeploymentId deploymentId); - - /** Returns the endpoints of each cluster in the given deployment — nothing global. */ - Map clusterEndpoints(DeploymentId deploymentId); - -} diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java deleted file mode 100644 index e768a090188..00000000000 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/routing/RoutingGeneratorMock.java +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. -package com.yahoo.vespa.hosted.controller.api.integration.routing; - -import com.yahoo.config.provision.ClusterSpec; -import com.yahoo.vespa.hosted.controller.api.identifiers.DeploymentId; - -import java.net.URI; -import java.util.List; -import java.util.Map; -import java.util.concurrent.ConcurrentHashMap; -import java.util.stream.Collectors; - -/** - * Returns a default set of endpoints on every query if it has no mappings, or those added by the user, otherwise. - * - * @author bratseth - * @author jonmv - */ -// TODO(mpolden): Remove -public class RoutingGeneratorMock implements RoutingGenerator { - - private final Map> routingTable = new ConcurrentHashMap<>(); - - @Override - public List endpoints(DeploymentId deployment) { - return routingTable.getOrDefault(deployment, List.of()); - } - - @Override - public Map clusterEndpoints(DeploymentId deployment) { - return endpoints(deployment).stream() - .limit(1) - .collect(Collectors.toMap(__ -> ClusterSpec.Id.from("default"), - endpoint -> URI.create(endpoint.endpoint()))); - } - - public void putEndpoints(DeploymentId deployment, List endpoints) { - routingTable.put(deployment, endpoints); - } - - public void removeEndpoints(DeploymentId deployment) { - routingTable.remove(deployment); - } - -} -- cgit v1.2.3