Codota Logo
HostSpec.<init>
Code IndexAdd Codota to your IDE (free)

How to use
com.yahoo.config.provision.HostSpec
constructor

Best Java code snippets using com.yahoo.config.provision.HostSpec.<init> (Showing top 10 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Point p =
  • Codota Iconnew Point(x, y)
  • Codota Iconnew Point()
  • Codota IconMouseEvent e;e.getPoint()
  • Smart code suggestions by Codota
}
origin: com.yahoo.vespa/config-model

@Override
public List<HostSpec> prepare(ClusterSpec cluster, Capacity capacity, int groups, ProvisionLogger logger) { // TODO: This should fail if capacity requested is more than 1
  List<HostSpec> hosts = new ArrayList<>();
  hosts.add(new HostSpec(host.hostname(), host.aliases(), ClusterMembership.from(cluster, counter++)));
  return hosts;
}
origin: com.yahoo.vespa/config-model

private HostSpec host2HostSpec(Host host) {
  return new HostSpec(host.hostname(), host.aliases());
}
origin: com.yahoo.vespa/config-model

Set<HostSpec> getHostSpecs() {
  return getHosts().stream()
      .map(host -> new HostSpec(host.getHostname(), Collections.emptyList(),
                   host.getFlavor(), host.primaryClusterMembership(), host.version()))
      .collect(Collectors.toCollection(LinkedHashSet::new));
}
origin: com.yahoo.vespa/config-model

@Override
public HostSpec allocateHost(String alias) {
  if (legacyMapping.containsKey(alias)) return legacyMapping.get(alias);
  List<Host> defaultHosts = freeNodes.get("default");
  if (defaultHosts.isEmpty()) throw new IllegalArgumentException("No more hosts of default flavor available");
  Host newHost = freeNodes.removeValue("default", 0);
  HostSpec hostSpec = new HostSpec(newHost.hostname(), newHost.aliases(), newHost.flavor(), Optional.empty(), newHost.version());
  legacyMapping.put(alias, hostSpec);
  return hostSpec;
}
origin: com.yahoo.vespa/node-repository

private List<HostSpec> asSortedHosts(List<Node> nodes) {
  nodes.sort(Comparator.comparingInt(node -> node.allocation().get().membership().index()));
  List<HostSpec> hosts = new ArrayList<>(nodes.size());
  for (Node node : nodes) {
    log.log(LogLevel.DEBUG, () -> "Prepared node " + node.hostname() + " - " + node.flavor());
    hosts.add(new HostSpec(node.hostname(),
                node.allocation().orElseThrow(IllegalStateException::new).membership(),
                node.flavor(),
                node.status().vespaVersion()));
  }
  return hosts;
}
origin: com.yahoo.vespa/config-model

private HostSpec retire(HostSpec host) {
  return new HostSpec(host.hostname(),
            host.aliases(),
            host.flavor(),
            Optional.of(host.membership().get().retire()),
            host.version());
}
origin: com.yahoo.vespa/config-provisioning

static HostSpec hostFromSlime(Inspector object, Optional<NodeFlavors> nodeFlavors) {
  Optional<ClusterMembership> membership =
      object.field(hostSpecMembership).valid() ? Optional.of(membershipFromSlime(object)) : Optional.empty();
  Optional<Flavor> flavor =
      object.field(hostSpecFlavor).valid() ? flavorFromSlime(object, nodeFlavors) : Optional.empty();
  Optional<com.yahoo.component.Version> version =
      optionalString(object.field(hostSpecCurrentVespaVersion)).map(com.yahoo.component.Version::new);
  return new HostSpec(object.field(hostSpecHostName).asString(), Collections.emptyList(), flavor, membership, version);
}
origin: com.yahoo.vespa/config-model

private List<HostSpec> allocateHostGroup(ClusterSpec clusterGroup, String flavor, int nodesInGroup, int startIndex, boolean canFail) {
  List<HostSpec> allocation = allocations.getOrDefault(clusterGroup, new ArrayList<>());
  allocations.put(clusterGroup, allocation);
  int nextIndex = nextIndexInCluster.getOrDefault(new Pair<>(clusterGroup.type(), clusterGroup.id()), startIndex);
  while (allocation.size() < nodesInGroup) {
    if (freeNodes.get(flavor).isEmpty()) {
      if (canFail)
        throw new IllegalArgumentException("Insufficient capacity of flavor '" + flavor + "'");
      else
        break;
    }
    Host newHost = freeNodes.removeValue(flavor, 0);
    ClusterMembership membership = ClusterMembership.from(clusterGroup, nextIndex++);
    allocation.add(new HostSpec(newHost.hostname(), newHost.aliases(), newHost.flavor(), Optional.of(membership), newHost.version()));
  }
  nextIndexInCluster.put(new Pair<>(clusterGroup.type(), clusterGroup.id()), nextIndex);
  while (allocation.size() > nodesInGroup)
    allocation.remove(0);
  return allocation;
}
origin: com.yahoo.vespa/config-model

@Override
public HostSpec allocateHost(String alias) {
  // Some special rules to allow no admin elements as well as jdisc element without nodes.
  if (alias.equals(IMPLICIT_ADMIN_HOSTALIAS)) {
    if (hosts.asCollection().size() > 1) {
      throw new IllegalArgumentException("More than 1 host specified (" + hosts.asCollection().size() + ") and <admin> not specified");
    } else {
      return host2HostSpec(getFirstHost());
    }
  } else if (alias.equals(Container.SINGLENODE_CONTAINER_SERVICESPEC)) {
    return host2HostSpec(getFirstHost());
  }
  for (Host host : hosts.asCollection()) {
    if (host.aliases().contains(alias)) {
      return new HostSpec(host.hostname(), host.aliases());
    }
  }
  throw new IllegalArgumentException("Unable to find host for alias '" + alias + "'");
}
origin: com.yahoo.vespa/config-model

public SingleNodeProvisioner() {
  host = new Host(HostName.getLocalhost());
  this.hostSpec = new HostSpec(host.hostname(), host.aliases());
}
com.yahoo.config.provisionHostSpec<init>

Popular methods of HostSpec

  • flavor
  • hostname
    Returns the name identifying this host
  • membership
    Returns the membership of this host, or an empty value if not present
  • version
    Returns the current version of Vespa running on this node, or empty if not known
  • aliases
    Returns the aliases of this host as an immutable list. This may be empty but never null.

Popular in Java

  • Finding current android device location
  • startActivity (Activity)
  • orElseThrow (Optional)
  • runOnUiThread (Activity)
  • URI (java.net)
    Represents a Uniform Resource Identifier (URI) reference. Aside from some minor deviations noted bel
  • Path (java.nio.file)
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Callable (java.util.concurrent)
    A task that returns a result and may throw an exception. Implementors define a single method with no
  • Location (org.springframework.beans.factory.parsing)
    Class that models an arbitrary location in a Resource.Typically used to track the location of proble
  • Option (scala)
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now