@Override public int compareTo(ApplicationId other) { int diff; diff = tenant.compareTo(other.tenant); if (diff != 0) { return diff; } diff = application.compareTo(other.application); if (diff != 0) { return diff; } diff = instance.compareTo(other.instance); if (diff != 0) { return diff; } return 0; }
/** Returns an application id where all fields are "default" */ public static ApplicationId defaultId() { return new ApplicationId(TenantName.defaultName(), ApplicationName.defaultName(), InstanceName.defaultName()); }
private SentinelConfig.Application.Builder getApplicationConfig() { SentinelConfig.Application.Builder builder = new SentinelConfig.Application.Builder(); builder.tenant(applicationId.tenant().value()); builder.name(applicationId.application().value()); builder.environment(zone.environment().value()); builder.region(zone.region().value()); builder.instance(applicationId.instance().value()); return builder; }
private void toSlime(ClusterMembership membership, Cursor object) { object.setString("clustertype", membership.cluster().type().name()); object.setString("clusterid", membership.cluster().id().value()); object.setString("group", String.valueOf(membership.cluster().group().get().index())); object.setLong("index", membership.index()); object.setBool("retired", membership.retired()); }
protected String toStringValue() { return cluster.type().name() + "/" + cluster.id().value() + (cluster.group().isPresent() ? "/" + cluster.group().get().index() : "") + "/" + index + ( cluster.isExclusive() ? "/exclusive" : "") + ( retired ? "/retired" : "") + ( !cluster.rotations().isEmpty() ? "/" + rotationsAsString(cluster.rotations()) : ""); }
private String getConfigserverIdentityName() { return String.format("%s.provider_%s_%s", zone.system() == SystemName.main ? "vespa.vespa" : "vespa.vespa.cd", zone.environment().value(), zone.region().value()); } }
public static ApplicationId from(String tenant, String application, String instance) { return new ApplicationId(TenantName.from(tenant), ApplicationName.from(application), InstanceName.from(instance)); }
/** Do not use */ public static Zone defaultZone() { return new Zone(SystemName.defaultSystem(), Environment.defaultEnvironment(), RegionName.defaultName()); }
/** Returns whether to reboot node as part of transition to given state. This is done to get rid of any lingering * unwanted state (e.g. processes) on non-host nodes. */ private boolean rebootOnTransitionTo(Node.State state, Node node) { if (node.type().isDockerHost()) return false; // Reboot of host nodes is handled by NodeRebooter if (zone.environment().isTest()) return false; // We want to reuse nodes quickly in test environments return node.state() != Node.State.dirty && state == Node.State.dirty; }
/** Returns whether this is equal, disregarding the group value and wanted Vespa version */ public boolean equalsIgnoringGroupAndVespaVersion(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; return true; }
public Builder() { this.tenant = TenantName.defaultName(); this.application = null; this.instance = InstanceName.defaultName(); }
/** * Returns a config server config containing the right zone settings (and defaults for the rest). * This is useful to allow applications to find out in which zone they are runnung by having the Zone * object (which is constructed from this config) injected. */ @Override public void getConfig(ConfigserverConfig.Builder builder) { builder.system(zone.system().name()); builder.environment(zone.environment().value()); builder.region(zone.region().value()); }