本文整理了Java中com.yahoo.component.Version.toFullString()
方法的一些代码示例,展示了Version.toFullString()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Version.toFullString()
方法的具体详情如下:
包路径:com.yahoo.component.Version
类名称:Version
方法名:toFullString
[英]Returns the string representation of this version identifier as major.minor.micro.qualifier, omitting .qualifier if qualifier empty or unspecified
This string form is part of the API of Version and will never change.
[中]将此版本标识符的字符串表示形式返回为主。少数的微型的。限定符,省略。限定符(如果限定符为空或未指定)
此字符串形式是版本API的一部分,永远不会更改。
代码示例来源:origin: com.yahoo.vespa/config-provisioning
/** Returns the Docker image tagged with the given version */
public DockerImage withTag(Version version) {
return new DockerImage(name + ":" + version.toFullString());
}
代码示例来源:origin: com.yahoo.vespa/node-repository
throw new IllegalArgumentException("Invalid target version: " + newTargetVersion.toFullString());
throw new IllegalArgumentException(String.format("Cannot downgrade version without setting 'force'. " +
"Current target version: %s, attempted to set target version: %s",
currentTargetVersion.get().toFullString(), newTargetVersion.toFullString()));
logger.info("Set target version for " + nodeType + " to " + newTargetVersion.toFullString());
代码示例来源:origin: com.yahoo.vespa/node-repository
/** 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());
}
}
代码示例来源:origin: com.yahoo.vespa/node-repository
public static byte[] toJson(Map<NodeType, Version> versions) {
Slime slime = new Slime();
Cursor object = slime.setObject();
versions.forEach((nodeType, version) -> object.setString(NodeSerializer.toString(nodeType),
version.toFullString()));
try {
return SlimeUtils.toJsonBytes(slime);
} catch (IOException e) {
throw new UncheckedIOException(e);
}
}
代码示例来源:origin: com.yahoo.vespa/config-provisioning
private void toSlime(HostSpec host, Cursor cursor) {
cursor.setString(hostSpecHostName, host.hostname());
host.membership().ifPresent(membership -> {
cursor.setString(hostSpecMembership, membership.stringValue());
cursor.setString(hostSpecVespaVersion, membership.cluster().vespaVersion().toFullString());
});
host.flavor().ifPresent(flavor -> cursor.setString(hostSpecFlavor, flavor.name()));
host.version().ifPresent(version -> cursor.setString(hostSpecCurrentVespaVersion, version.toFullString()));
}
代码示例来源:origin: com.yahoo.vespa/node-repository
@Override
public void render(OutputStream stream) throws IOException {
Slime slime = new Slime();
Cursor root = slime.setObject();
Cursor versionsObject = root.setObject("versions");
infrastructureVersions.getTargetVersions().forEach((nodeType, version) -> versionsObject.setString(nodeType.name(), version.toFullString()));
Cursor osVersionsObject = root.setObject("osVersions");
osVersions.targets().forEach((nodeType, version) -> osVersionsObject.setString(nodeType.name(), version.toFullString()));
new JsonFormat(true).encode(stream, slime);
}
代码示例来源:origin: com.yahoo.vespa/node-repository
private MessageResponse setTargetVersions(HttpRequest request) {
NodeType nodeType = NodeType.valueOf(lastElement(request.getUri().getPath()).toLowerCase());
Inspector inspector = toSlime(request.getData()).get();
List<String> messageParts = new ArrayList<>(3);
boolean force = inspector.field("force").asBool();
Inspector versionField = inspector.field("version");
Inspector osVersionField = inspector.field("osVersion");
if (versionField.valid()) {
Version version = Version.fromString(versionField.asString());
maintenance.infrastructureVersions().setTargetVersion(nodeType, version, force);
messageParts.add("version to " + version.toFullString());
}
if (osVersionField.valid()) {
String v = osVersionField.asString();
if (v.isEmpty()) {
nodeRepository.osVersions().removeTarget(nodeType);
messageParts.add("osVersion to null");
} else {
Version osVersion = Version.fromString(v);
nodeRepository.osVersions().setTarget(nodeType, osVersion, force);
messageParts.add("osVersion to " + osVersion.toFullString());
}
}
if (messageParts.isEmpty()) {
throw new IllegalArgumentException("At least one of 'version' and 'osVersion' must be set");
}
return new MessageResponse("Set " + String.join(", ", messageParts) +
" for nodes of type " + nodeType);
}
代码示例来源:origin: com.yahoo.vespa/config-model
@Override
public void getConfig(ModelConfig.Builder builder) {
builder.vespaVersion(vespaVersion.toFullString());
for (HostResource modelHost : getHostSystem().getHosts()) {
builder.hosts(new Hosts.Builder()
.name(modelHost.getHostname())
.services(getServices(modelHost))
);
}
}
代码示例来源:origin: com.yahoo.vespa/node-repository
object.setLong("currentRestartGeneration", node.allocation().get().restartGeneration().current());
object.setString("wantedDockerImage", nodeRepository.dockerImage().withTag(node.allocation().get().membership().cluster().vespaVersion()).asString());
object.setString("wantedVespaVersion", node.allocation().get().membership().cluster().vespaVersion().toFullString());
try {
object.setBool("allowedToBeDown",
node.status().osVersion().ifPresent(version -> object.setString("currentOsVersion", version.toFullString()));
nodeRepository.osVersions().targetFor(node.type()).ifPresent(version -> object.setString("wantedOsVersion", version.toFullString()));
node.status().firmwareVerifiedAt().ifPresent(instant -> object.setLong("currentFirmwareCheck", instant.toEpochMilli()));
if (node.type().isDockerHost())
.filter(version -> !version.isEmpty())
.ifPresent(version -> {
object.setString("vespaVersion", version.toFullString());
object.setString("currentDockerImage", nodeRepository.dockerImage().withTag(version).asString());
});
内容来源于网络,如有侵权,请联系作者删除!