blob: 0e0d8b2310bd6fb6d1c2c3116be94a032d8a6b70 (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.provision.applications;
import java.util.Objects;
/**
* An application's status
*
* @author bratseth
*/
public class Status {
private final double currentReadShare;
private final double maxReadShare;
/** Do not use */
public Status(double currentReadShare, double maxReadShare) {
this.currentReadShare = currentReadShare;
this.maxReadShare = maxReadShare;
}
public Status withCurrentReadShare(double currentReadShare) {
return new Status(currentReadShare, maxReadShare);
}
/**
* Returns the current fraction of the global traffic to this application that is received by the
* deployment in this zone.
*/
public double currentReadShare() { return currentReadShare; }
public Status withMaxReadShare(double maxReadShare) {
return new Status(currentReadShare, maxReadShare);
}
/**
* Returns an estimate of the max fraction of the global traffic to this application that may possibly
* be received by the deployment in this zone.
*/
public double maxReadShare() { return maxReadShare; }
public static Status initial() { return new Status(0, 0); }
@Override
public int hashCode() {
return Objects.hash(currentReadShare, maxReadShare);
}
@Override
public boolean equals(Object o) {
if (o == this) return true;
if ( ! (o instanceof Status)) return false;
Status other = (Status)o;
if ( other.currentReadShare != this.currentReadShare) return false;
if ( other.maxReadShare != this.maxReadShare) return false;
return true;
}
@Override
public String toString() {
return "application status: [" +
"currentReadShare: " + currentReadShare + ", " +
"maxReadShare: " + maxReadShare +
"]";
}
}
|