blob: c40408c910992748a82c7091da65003c79ba15ab (
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
|
package com.yahoo.vespa.hosted.provision.applications;
import com.yahoo.vespa.hosted.provision.autoscale.Autoscaler;
import java.util.Objects;
/**
* The current autoscaling status of a cluster.
* A value object.
*
* @author bratseth
*/
public class AutoscalingStatus {
public enum Status {
/** No status is available: Aautoscaling is disabled, or a brand new application. */
unavailable,
/** Autoscaling is not taking any action at the moment due to recent changes or a lack of data */
waiting,
/** The cluster is ideally scaled to the current load */
ideal,
/** The cluster should be rescaled further, but no better configuration is allowed by the current limits */
insufficient,
/** Rescaling of this cluster has been scheduled */
rescaling
};
private final Status status;
private final String description;
public AutoscalingStatus(Status status, String description) {
this.status = status;
this.description = description;
}
public Status status() { return status; }
public String description() { return description; }
public static AutoscalingStatus empty() { return new AutoscalingStatus(Status.unavailable, ""); }
@Override
public boolean equals(Object o) {
if (o == this) return true;
if ( ! ( o instanceof AutoscalingStatus)) return false;
AutoscalingStatus other = (AutoscalingStatus)o;
if ( other.status != this.status ) return false;
if ( ! other.description.equals(this.description) ) return false;
return true;
}
@Override
public int hashCode() {
return Objects.hash(status, description);
}
@Override
public String toString() {
return "autoscaling status: " + status +
( description.isEmpty() ? "" : " (" + description + ")");
}
}
|