blob: 06002e874f1f4c0d7dfe194b249874242bc01401 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
// 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.routing;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.zone.ZoneId;
import java.util.Objects;
/**
* Unique identifier for a {@link RoutingPolicy}.
*
* @author mpolden
*/
public class RoutingPolicyId {
private final ApplicationId owner;
private final ClusterSpec.Id cluster;
private final ZoneId zone;
public RoutingPolicyId(ApplicationId owner, ClusterSpec.Id cluster, ZoneId zone) {
this.owner = Objects.requireNonNull(owner, "owner must be non-null");
this.cluster = Objects.requireNonNull(cluster, "cluster must be non-null");
this.zone = Objects.requireNonNull(zone, "zone must be non-null");
}
/** The application owning this */
public ApplicationId owner() {
return owner;
}
/** The zone this applies to */
public ZoneId zone() {
return zone;
}
/** The cluster this applies to */
public ClusterSpec.Id cluster() {
return cluster;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
RoutingPolicyId that = (RoutingPolicyId) o;
return owner.equals(that.owner) &&
cluster.equals(that.cluster) &&
zone.equals(that.zone);
}
@Override
public int hashCode() {
return Objects.hash(owner, cluster, zone);
}
}
|