diff options
author | Martin Polden <mpolden@mpolden.no> | 2021-11-26 14:16:51 +0100 |
---|---|---|
committer | Martin Polden <mpolden@mpolden.no> | 2021-11-26 14:18:33 +0100 |
commit | f09dd864789053767d31549cd9d0804514eebe6b (patch) | |
tree | b4d9d34a1bcc0e7ed1438b2685cbb03f60c37eca /controller-api | |
parent | a466ce2f31e4eb7bf037c66800173e2621bff5c8 (diff) |
Send container endpoint routing method on deploy
Diffstat (limited to 'controller-api')
-rw-r--r-- | controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java index 159e4aa15da..7246903a51b 100644 --- a/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java +++ b/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/ContainerEndpoint.java @@ -1,6 +1,8 @@ // Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. package com.yahoo.vespa.hosted.controller.api.integration.configserver; +import com.yahoo.config.provision.zone.RoutingMethod; + import java.util.List; import java.util.Objects; import java.util.OptionalInt; @@ -16,12 +18,14 @@ public class ContainerEndpoint { private final String scope; private final List<String> names; private final OptionalInt weight; + private final RoutingMethod routingMethod; - public ContainerEndpoint(String clusterId, String scope, List<String> names, OptionalInt weight) { + public ContainerEndpoint(String clusterId, String scope, List<String> names, OptionalInt weight, RoutingMethod routingMethod) { this.clusterId = nonEmpty(clusterId, "clusterId must be non-empty"); this.scope = Objects.requireNonNull(scope, "scope must be non-null"); this.names = List.copyOf(Objects.requireNonNull(names, "names must be non-null")); this.weight = Objects.requireNonNull(weight, "weight must be non-null"); + this.routingMethod = Objects.requireNonNull(routingMethod, "routingMethod must be non-null"); } /** ID of the cluster to which this points */ @@ -47,23 +51,28 @@ public class ContainerEndpoint { return weight; } + /** The routing method used by this endpoint */ + public RoutingMethod routingMethod() { + return routingMethod; + } + @Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; ContainerEndpoint that = (ContainerEndpoint) o; - return clusterId.equals(that.clusterId) && scope.equals(that.scope) && names.equals(that.names) && weight.equals(that.weight); + return clusterId.equals(that.clusterId) && scope.equals(that.scope) && names.equals(that.names) && weight.equals(that.weight) && routingMethod == that.routingMethod; } @Override public int hashCode() { - return Objects.hash(clusterId, scope, names, weight); + return Objects.hash(clusterId, scope, names, weight, routingMethod); } @Override public String toString() { return "container endpoint for cluster " + clusterId + ": " + String.join(", ", names) + - " [scope=" + scope + ",weight=" + + " [method=" + routingMethod + ",scope=" + scope + ",weight=" + weight.stream().boxed().map(Object::toString).findFirst().orElse("<none>") + "]"; } |