blob: 7fa3bd45b4cf3a1bf1ea7795a96cd9bd3141ffd1 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.orchestrator.model;
import com.yahoo.vespa.applicationmodel.ClusterId;
import com.yahoo.vespa.applicationmodel.ServiceType;
import com.yahoo.vespa.orchestrator.policy.HostStateChangeDeniedException;
import com.yahoo.vespa.orchestrator.policy.SuspensionReasons;
import java.util.Optional;
public interface ClusterApi {
ApplicationApi getApplication();
NodeGroup getNodeGroup();
String clusterInfo();
ClusterId clusterId();
ServiceType serviceType();
/** Some human-readable string naming the service(s) to a human reader. */
String serviceDescription(boolean plural);
boolean isStorageCluster();
boolean isConfigServerLike();
/** Returns the non-empty reasons for why all services are down, or otherwise empty. */
Optional<SuspensionReasons> allServicesDown();
boolean noServicesOutsideGroupIsDown() throws HostStateChangeDeniedException;
/** Returns the number of services currently in the cluster, plus the number of missing services. */
int size();
int servicesDownOutsideGroup();
default int percentageOfServicesDownOutsideGroup() { return sizePercentageOf(servicesDownOutsideGroup()); }
int servicesDownIfGroupIsAllowedToBeDown();
default int percentageOfServicesDownIfGroupIsAllowedToBeDown() { return sizePercentageOf(servicesDownIfGroupIsAllowedToBeDown()); }
ClusterPolicyOverride clusterPolicyOverride();
Optional<StorageNode> storageNodeInGroup();
String downDescription();
private int sizePercentageOf(int count) { return (int) Math.round(100.0 * count / size()); }
}
|