aboutsummaryrefslogtreecommitdiffstats
path: root/controller-api/src/main/java/com/yahoo/vespa/hosted/controller/api/integration/configserver/NodeRepository.java
blob: 220acc4c615036f7bedbbbfc5b0e16ae64a4d44d (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright Vespa.ai. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.configserver;

import com.yahoo.component.Version;
import com.yahoo.config.provision.ApplicationId;
import com.yahoo.config.provision.ClusterSpec;
import com.yahoo.config.provision.HostName;
import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.zone.ZoneId;
import com.yahoo.vespa.hosted.controller.api.integration.archive.ArchiveUriUpdate;
import com.yahoo.vespa.hosted.controller.api.integration.noderepository.ApplicationPatch;

import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
 * Node repository interface intended for use by the controller.
 *
 * @author mpolden
 */
public interface NodeRepository {

    /** Add new nodes to the node repository */
    void addNodes(ZoneId zone, List<Node> nodes);

    /** Delete node */
    void deleteNode(ZoneId zone, String hostname);

    /** Move node to given state */
    void setState(ZoneId zone, Node.State state, String hostname);

    /** Get node from zone */
    Node getNode(ZoneId zone, String hostname);

    /** List nodes in given zone matching given filter */
    List<Node> list(ZoneId zone, NodeFilter filter);

    /** Get node repository's view of given application */
    Application getApplication(ZoneId zone, ApplicationId application);

    /** Update application */
    void patchApplication(ZoneId zone, ApplicationId application, ApplicationPatch patch);

    /** Get node statistics such as cost and load from given zone */
    NodeRepoStats getStats(ZoneId zone);

    /** Get all archive URIs found in zone */
    ArchiveUris getArchiveUris(ZoneId zone);

    /** Update some archive URI in the given zone */
    void updateArchiveUri(ZoneId zone, ArchiveUriUpdate archiveUriUpdate);

    /** Upgrade all nodes of given type to a new version */
    void upgrade(ZoneId zone, NodeType type, Version version, boolean allowDowngrade);

    /** Upgrade OS for all nodes of given type to a new version */
    void upgradeOs(ZoneId zone, NodeType type, Version version, boolean allowDowngrade);

    /** Get target versions for upgrades in given zone */
    TargetVersions targetVersionsOf(ZoneId zone);

    /** Requests firmware checks on all hosts in the given zone. */
    void requestFirmwareCheck(ZoneId zone);

    /** Cancels firmware checks on all hosts in the given zone. */
    void cancelFirmwareCheck(ZoneId zone);

    /** Retire given node */
    void retire(ZoneId zone, String hostname, boolean wantToRetire, boolean wantToDeprovision);

    /** Drop all documents on content nodes in the given zone, application and cluster */
    void dropDocuments(ZoneId zoneId, ApplicationId applicationId, Optional<ClusterSpec.Id> clusterId);

    /** Update reports for given node. A key with null value clears that report */
    void updateReports(ZoneId zone, String hostname, Map<String, String> reports);

    /** Update hardware model */
    void updateModel(ZoneId zone, String hostname, String modelName);

    /** Update switch hostname */
    void updateSwitchHostname(ZoneId zone, String hostname, String switchHostname);

    /** Schedule reboot of given node */
    void reboot(ZoneId zone, String hostname);

    /** Checks whether the zone has the spare capacity to remove the given hosts */
    boolean isReplaceable(ZoneId zone, List<HostName> hostnames);

}