com.yahoo.vespa.hosted.provision.provisioning.DockerImages Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of node-repository Show documentation
Show all versions of node-repository Show documentation
Keeps track of node assignment in a multi-application setup.
// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.provisioning;
import com.google.common.base.Supplier;
import com.google.common.base.Suppliers;
import com.yahoo.config.provision.DockerImage;
import com.yahoo.config.provision.NodeType;
import com.yahoo.vespa.curator.Lock;
import com.yahoo.vespa.hosted.provision.persistence.CuratorDatabaseClient;
import java.time.Duration;
import java.util.Collections;
import java.util.Map;
import java.util.Optional;
import java.util.concurrent.TimeUnit;
import java.util.logging.Logger;
/**
* Multithread safe class to get and set docker images for given host types.
*
* @author freva
*/
public class DockerImages {
private static final Duration defaultCacheTtl = Duration.ofMinutes(1);
private static final Logger log = Logger.getLogger(DockerImages.class.getName());
private final CuratorDatabaseClient db;
private final DockerImage defaultImage;
private final Duration cacheTtl;
/**
* Docker image is read on every request to /nodes/v2/node/[fqdn]. Cache current getDockerImages to avoid
* unnecessary ZK reads. When getDockerImages change, some nodes may need to wait for TTL until they see the new target,
* this is fine.
*/
private volatile Supplier
© 2015 - 2025 Weber Informatics LLC | Privacy Policy