summaryrefslogtreecommitdiffstats
path: root/config-provisioning/src/main/java/com/yahoo/config/provision/HostLivenessTracker.java
blob: f3326ec2bc886a8359e37df50dc75bee1ba03333 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.config.provision;

import java.time.Instant;
import java.util.Optional;

/**
 * Instances of this are used to keep track of (notify and query)
 * which hosts are currently connected to the config system.
 * 
 * @author bratseth
 */
public interface HostLivenessTracker {

    /** Called each time a config request is received from a client */
    void receivedRequestFrom(String hostname);

    /** 
     * Returns the epoch timestamp of the last request received from the given hostname,
     * or empty if there is no memory of this host making a request
     */
    Optional<Instant> lastRequestFrom(String hostname);

}