diff options
author | Jon Bratseth <bratseth@verizonmedia.com> | 2019-08-14 15:18:43 +0200 |
---|---|---|
committer | Jon Bratseth <bratseth@verizonmedia.com> | 2019-08-14 15:18:43 +0200 |
commit | dd188dbb522a2d8d1b90fdc278225aaca6191dce (patch) | |
tree | e60a1921bd7898c1d19be7db8a77f998febcd6c8 /config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java | |
parent | e134f307f2e962d07ae2cf5a6299e355dc618a41 (diff) |
Remove flavor replaces concept
Diffstat (limited to 'config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java')
-rw-r--r-- | config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java | 48 |
1 files changed, 3 insertions, 45 deletions
diff --git a/config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java b/config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java index 93ca0a77806..dd33cd58d1d 100644 --- a/config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java +++ b/config-provisioning/src/main/java/com/yahoo/config/provision/Flavor.java @@ -22,7 +22,6 @@ public class Flavor { private final Type type; private final double bandwidth; private final boolean retired; - private List<Flavor> replacesFlavors; /** The hardware resources of this flavor */ private NodeResources resources; @@ -39,7 +38,6 @@ public class Flavor { flavorConfig.fastDisk() ? NodeResources.DiskSpeed.fast : NodeResources.DiskSpeed.slow); this.bandwidth = flavorConfig.bandwidth(); this.retired = flavorConfig.retired(); - this.replacesFlavors = new ArrayList<>(); } /** Creates a *node* flavor from a node resources spec */ @@ -51,7 +49,6 @@ public class Flavor { this.type = Type.DOCKER_CONTAINER; this.bandwidth = 1; this.retired = false; - this.replacesFlavors = List.of(); this.resources = resources; } @@ -94,54 +91,15 @@ public class Flavor { /** Convenience, returns getType() == Type.DOCKER_CONTAINER */ public boolean isDocker() { return type == Type.DOCKER_CONTAINER; } - /** - * Returns the canonical name of this flavor - which is the name which should be used as an interface to users. - * The canonical name of this flavor is: - * <ul> - * <li>If it replaces one flavor, the canonical name of the flavor it replaces - * <li>If it replaces multiple or no flavors - itself - * </ul> - * - * The logic is that we can use this to capture the gritty details of configurations in exact flavor names - * but also encourage users to refer to them by a common name by letting such flavor variants declare that they - * replace the canonical name we want. However, if a node replaces multiple names, we have no basis for choosing one - * of them as the canonical, so we return the current as canonical. - */ public String canonicalName() { - return isCanonical() ? name : replacesFlavors.get(0).canonicalName(); + return name; } - /** Returns whether this is a canonical flavor */ - public boolean isCanonical() { - return replacesFlavors.size() != 1; - } - /** - * The flavors this (directly) replaces. - * This is immutable if this is frozen, and a mutable list otherwise. - */ - public List<Flavor> replaces() { return replacesFlavors; } - - /** - * Returns whether this flavor satisfies the requested flavor, either directly - * (by being the same), or by directly or indirectly replacing it + * Returns whether this flavor satisfies the requested flavor */ public boolean satisfies(Flavor flavor) { - if (this.equals(flavor)) { - return true; - } - if (this.retired) { - return false; - } - for (Flavor replaces : replacesFlavors) - if (replaces.satisfies(flavor)) - return true; - return false; - } - - /** Irreversibly freezes the content of this */ - public void freeze() { - replacesFlavors = List.copyOf(replacesFlavors); + return this.equals(flavor); } @Override |