Put information on assigned regions in AssignedRotation class
package com.yahoo.vespa.hosted.controller.application;
import com.yahoo.config.provision.ClusterSpec;
+import com.yahoo.config.provision.RegionName;
import com.yahoo.vespa.hosted.controller.rotation.RotationId;
import java.util.Objects;
+import java.util.Set;
/**
- * Contains the tuple of [clusterId, endpointId, rotationId], to keep track
+ * Contains the tuple of [clusterId, endpointId, rotationId, regions[]], to keep track
* of which services have assigned which rotations under which name.
*
* @author ogronnesby
@@ -15,16 +17,19 @@ public class AssignedRotation {
private final ClusterSpec.Id clusterId;
private final EndpointId endpointId;
private final RotationId rotationId;
+ private final Set<RegionName> regions;
- public AssignedRotation(ClusterSpec.Id clusterId, EndpointId endpointId, RotationId rotationId) {
+ public AssignedRotation(ClusterSpec.Id clusterId, EndpointId endpointId, RotationId rotationId, Set<RegionName> regions) {
this.clusterId = requireNonEmpty(clusterId, clusterId.value(), "clusterId");
this.endpointId = Objects.requireNonNull(endpointId);
this.rotationId = Objects.requireNonNull(rotationId);
+ this.regions = Set.copyOf(Objects.requireNonNull(regions));
}
public ClusterSpec.Id clusterId() { return clusterId; }
public EndpointId endpointId() { return endpointId; }
public RotationId rotationId() { return rotationId; }
+ public Set<RegionName> regions() { return regions; }
@Override
public String toString() {
@@ -32,6 +37,7 @@ public class AssignedRotation {
"clusterId=" + clusterId +
", endpointId='" + endpointId + '\'' +
", rotationId=" + rotationId +
+ ", regions=" + regions +
'}';
}
@@ -42,12 +48,13 @@ public class AssignedRotation {
AssignedRotation that = (AssignedRotation) o;
return clusterId.equals(that.clusterId) &&
endpointId.equals(that.endpointId) &&
- rotationId.equals(that.rotationId);
+ rotationId.equals(that.rotationId) &&
+ regions.equals(that.regions);
}
@Override
public int hashCode() {
- return Objects.hash(clusterId, endpointId, rotationId);
+ return Objects.hash(clusterId, endpointId, rotationId, regions);
}
private static <T> T requireNonEmpty(T object, String value, String field) {
