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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
// Copyright 2018 Yahoo Holdings. 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.HostName;
import com.yahoo.config.provision.NodeType;
import com.yahoo.config.provision.TenantName;
import com.yahoo.config.provision.zone.ZoneId;
import java.net.URI;
import java.time.Duration;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.stream.Collectors;
/**
* 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 all nodes in given zone */
List<Node> list(ZoneId zone, boolean includeDeprovisioned);
/** List all nodes in zone having given hostnames */
List<Node> list(ZoneId zone, List<HostName> hostnames);
/** List all nodes in zone owned by given application */
List<Node> list(ZoneId zone, ApplicationId application);
/** List all nodes in states, in zone owned by given application */
default List<Node> list(ZoneId zone, ApplicationId application, Set<Node.State> states) {
return list(zone, application).stream()
.filter(node -> states.contains(node.state()))
.collect(Collectors.toList());
}
/** Get node repository's view of given application */
Application getApplication(ZoneId zone, ApplicationId application);
/** Update application */
void patchApplication(ZoneId zone, ApplicationId application,
double currentReadShare, double maxReadShare);
/** Get node statistics such as cost and load from given zone */
NodeRepoStats getStats(ZoneId zone);
/** Get all archive URLs found in zone */
Map<TenantName, URI> getArchiveUris(ZoneId zone);
/** Update archive URL for given tenant */
void setArchiveUri(ZoneId zone, TenantName tenantName, URI archiveUri);
/** Remove archive URL for given tenant */
void removeArchiveUri(ZoneId zone, TenantName tenantName);
/** Upgrade all nodes of given type to a new version */
void upgrade(ZoneId zone, NodeType type, Version version);
/** Upgrade OS for all nodes of given type to a new version */
void upgradeOs(ZoneId zone, NodeType type, Version version, Optional<Duration> upgradeBudget);
/** 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);
/** 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);
}
|