diff options
author | Håkon Hallingstad <hakon@yahooinc.com> | 2023-11-02 16:52:56 +0100 |
---|---|---|
committer | Håkon Hallingstad <hakon@yahooinc.com> | 2023-11-02 16:52:56 +0100 |
commit | b02d1228c2e0d957651c094a3af367d6229d2ae3 (patch) | |
tree | 84a4f16dbc1850385d48251253807cd8b2e3eb08 /flags/src/main/java | |
parent | ef89054d86570de1934d34e880b4827a310b9269 (diff) |
Retire if there are shared hosts dedicated to cluster type
Diffstat (limited to 'flags/src/main/java')
-rw-r--r-- | flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java index 3f6b20ccfa4..66356d979a4 100644 --- a/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java +++ b/flags/src/main/java/com/yahoo/vespa/flags/custom/SharedHost.java @@ -41,9 +41,16 @@ public class SharedHost { return resources.isEmpty() ? null : resources; } + /** Whether there are any shared hosts specifically for the given cluster type, or without a cluster type restriction. */ @JsonIgnore - public boolean isEnabled(String clusterType) { - return resources.stream().anyMatch(hr -> hr.satisfiesClusterType(clusterType)); + public boolean supportsClusterType(String clusterType) { + return resources.stream().anyMatch(resource -> resource.clusterType().map(clusterType::equalsIgnoreCase).orElse(true)); + } + + /** Whether there are any shared hosts specifically for the given cluster type. */ + @JsonIgnore + public boolean hasClusterType(String clusterType) { + return resources.stream().anyMatch(resource -> resource.clusterType().map(clusterType::equalsIgnoreCase).orElse(false)); } @JsonIgnore |