Codota Logo
HostSpec.membership
Code IndexAdd Codota to your IDE (free)

How to use
membership
method
in
com.yahoo.config.provision.HostSpec

Best Java code snippets using com.yahoo.config.provision.HostSpec.membership (Showing top 7 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/node-repository

private void validate(Collection<HostSpec> hosts) {
  for (HostSpec host : hosts) {
    if ( ! host.membership().isPresent())
      throw new IllegalArgumentException("Hosts must be assigned a cluster when activating, but got " + host);
    if ( ! host.membership().get().cluster().group().isPresent())
      throw new IllegalArgumentException("Hosts must be assigned a group when activating, but got " + host);
  }
}
origin: com.yahoo.vespa/config-model

public HostResource getHost(String hostAlias) {
  HostSpec hostSpec = provisioner.allocateHost(hostAlias);
  for (HostResource resource : hostname2host.values()) {
    if (resource.getHostname().equals(hostSpec.hostname())) {
      hostSpec.membership().ifPresent(resource::addClusterMembership);
      return resource;
    }
  }
  return addNewHost(hostSpec);
}
origin: com.yahoo.vespa/config-model

public Map<HostResource, ClusterMembership> allocateHosts(ClusterSpec cluster, Capacity capacity, int groups, DeployLogger logger) {
  List<HostSpec> allocatedHosts = provisioner.prepare(cluster, capacity, groups, new ProvisionDeployLogger(logger));
  // TODO: Even if HostResource owns a set of memberships, we need to return a map because the caller needs the current membership.
  Map<HostResource, ClusterMembership> retAllocatedHosts = new LinkedHashMap<>();
  for (HostSpec spec : allocatedHosts) {
    // This is needed for single node host provisioner to work in unit tests for hosted vespa applications.
    HostResource host = getExistingHost(spec).orElseGet(() -> addNewHost(spec));
    retAllocatedHosts.put(host, spec.membership().orElse(null));
    if (! host.getFlavor().isPresent()) {
      host.setFlavor(spec.flavor());
      log.log(DEBUG, () -> "Host resource " + host.getHostname() + " had no flavor, setting to " + spec.flavor());
    }
  }
  retAllocatedHosts.keySet().forEach(host -> log.log(DEBUG, () -> "Allocated host " + host.getHostname() + " with flavor " + host.getFlavor()));
  return retAllocatedHosts;
}
origin: com.yahoo.vespa/node-repository

/**
 * Returns the input nodes with the changes resulting from applying the settings in hosts to the given list of nodes.
 */
private List<Node> updateFrom(Collection<HostSpec> hosts, List<Node> nodes) {
  List<Node> updated = new ArrayList<>();
  for (Node node : nodes) {
    HostSpec hostSpec = getHost(node.hostname(), hosts);
    node = hostSpec.membership().get().retired() ? node.retire(nodeRepository.clock().instant()) : node.unretire();
    node = node.with(node.allocation().get().with(hostSpec.membership().get()));
    if (hostSpec.flavor().isPresent()) // Docker nodes may change flavor
      node = node.with(hostSpec.flavor().get());
    updated.add(node);
  }
  return updated;
}
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-model

private HostResource addNewHost(HostSpec hostSpec) {
  Host host = Host.createHost(this, hostSpec.hostname());
  HostResource hostResource = new HostResource(host, hostSpec.version());
  hostResource.setFlavor(hostSpec.flavor());
  hostSpec.membership().ifPresent(hostResource::addClusterMembership);
  hostname2host.put(host.getHostname(), hostResource);
  log.log(DEBUG, () -> "Added new host resource for " + host.getHostname() + " with flavor " + hostResource.getFlavor());
  return hostResource;
}
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()));
}
com.yahoo.config.provisionHostSpecmembership

Javadoc

The current membership role of this host in the cluster it belongs to

Popular methods of HostSpec

  • <init>
  • flavor
  • hostname
    Returns the name identifying this host
  • 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

  • Making http post requests using okhttp
  • scheduleAtFixedRate (Timer)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • getContentResolver (Context)
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • BigDecimal (java.math)
    An immutable arbitrary-precision signed decimal.A value is represented by an arbitrary-precision "un
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • DateFormat (java.text)
    Formats or parses dates and times.This class provides factories for obtaining instances configured f
  • Scanner (java.util)
    A parser that parses a text string of primitive types and strings with the help of regular expressio
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
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