// Copyright Yahoo. 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.yahoo.lang.CachedSupplier;
import com.yahoo.vespa.hosted.provision.persistence.CuratorDb;
import java.time.Clock;
import java.time.Duration;
import java.time.Instant;
import java.util.Optional;
/**
* Keeps cached data about when to do a firmware check on the hosts managed by a node repository.
*
* The data kept here is managed through POST and DELETE to /nodes/v2/upgrade/firmware
*
* Reads and writes are not locked, as writes do not depend on prior state. *
* Local cache expires periodically, and on writes from this host, for testing.
*
* @author jonmv
*/
public class FirmwareChecks {
private static final Duration cacheExpiry = Duration.ofMinutes(1);
private final CuratorDb database;
private final Clock clock;
private final CachedSupplier