public boolean upgrading() { return !current.equals(wanted); } }
@Override public boolean equals(Object obj) { if (!(obj instanceof CacheKey)) { return false; } CacheKey rhs = (CacheKey)obj; if (!version.equals(rhs.version)) { return false; } if (type != rhs.type) { return false; } return true; } }
/** Returns whether this equals the empty version */ public boolean isEmpty() { return this.equals(emptyVersion); }
@Override public boolean equals(Object object) { if (!(object instanceof ConfigModelId)) return false; ConfigModelId other = (ConfigModelId)object; return this.name.equals(other.name) && this.version.equals(other.version); }
/** Returns whether this version number (ignoring qualifier) is strictly higher than the given version */ public boolean isAfter(Version other) { return ! this.isBefore(other) && ! this.equals(other); }
private void checkVersion(Element spec) { String version = spec.getAttribute("version"); if ( ! Version.fromString(version).equals(new Version(1))) { throw new RuntimeException("Expected container version to be 1.0, but got " + version); } }
@Override public boolean equals(Object o) { if (o == this) return true; if ( ! (o instanceof ClusterSpec)) return false; ClusterSpec other = (ClusterSpec)o; if ( ! other.type.equals(this.type)) return false; if ( ! other.id.equals(this.id)) return false; if ( ! other.groupId.equals(this.groupId)) return false; if ( ! other.vespaVersion.equals(this.vespaVersion)) return false; return true; }
private ApplicationVersion(Optional<SourceRevision> source, OptionalLong buildNumber, Optional<String> authorEmail, Optional<Version> compileVersion, Optional<Instant> buildTime) { Objects.requireNonNull(source, "source cannot be null"); Objects.requireNonNull(buildNumber, "buildNumber cannot be null"); Objects.requireNonNull(authorEmail, "author cannot be null"); if (source.isPresent() != buildNumber.isPresent()) { throw new IllegalArgumentException("both buildNumber and source must be set together"); } if (compileVersion.isPresent() != buildTime.isPresent()) { throw new IllegalArgumentException("both compileVersion and buildTime must be set together"); } if (buildNumber.isPresent() && buildNumber.getAsLong() <= 0) { throw new IllegalArgumentException("buildNumber must be > 0"); } if (authorEmail.isPresent() && ! authorEmail.get().matches("[^@]+@[^@]+")) { throw new IllegalArgumentException("Invalid author email '" + authorEmail.get() + "'."); } if (compileVersion.isPresent() && compileVersion.get().equals(Version.emptyVersion)) { throw new IllegalArgumentException("The empty version is not a legal compile version."); } this.source = source; this.buildNumber = buildNumber; this.authorEmail = authorEmail; this.compileVersion = compileVersion; this.buildTime = buildTime; }
@Override public boolean matches(Node node) { if (!version.isEmpty() && !node.status().osVersion().filter(v -> v.equals(version)).isPresent()) { return false; } return nextMatches(node); }
/** Set the target OS version for nodes of given type */ public void setTarget(NodeType nodeType, Version newTarget, boolean force) { if (!nodeType.isDockerHost()) { throw new IllegalArgumentException("Setting target OS version for " + nodeType + " nodes is unsupported"); } if (newTarget.isEmpty()) { throw new IllegalArgumentException("Invalid target version: " + newTarget.toFullString()); } try (Lock lock = db.lockOsVersions()) { Map<NodeType, Version> osVersions = db.readOsVersions(); Optional<Version> oldTarget = Optional.ofNullable(osVersions.get(nodeType)); if (oldTarget.filter(v -> v.equals(newTarget)).isPresent()) { return; // Old target matches new target, nothing to do } if (!force && oldTarget.filter(v -> v.isAfter(newTarget)).isPresent()) { throw new IllegalArgumentException("Cannot set target OS version to " + newTarget + " without setting 'force', as it's lower than the current version: " + oldTarget.get()); } osVersions.put(nodeType, newTarget); db.writeOsVersions(osVersions); createCache(); // Throw away current cache log.info("Set OS target version for " + nodeType + " nodes to " + newTarget.toFullString()); } }
node.state() == Node.State.active && node.allocation() .map(allocation -> allocation.membership().cluster().vespaVersion().equals(targetVersion.get())) .orElse(false))) { List<HostSpec> hostSpecs = provisioner.prepare(
currentVersion.get().equals(wantedVersion); metric.set("wantToChangeVespaVersion", converged ? 0 : 1, context); } else {