blob: 193d4a05cc569a03ddc4ec53d3c709375a4f518e (
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
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.clustercontroller.core.hostinfo;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.ArrayList;
import java.util.List;
/**
* Keeping information about a storage node seen from the distributor.
*
* @author Haakon Dybdahl
*/
public class StorageNode {
static public class BucketStats {
private final long total;
private final long pending;
@JsonCreator
public BucketStats(@JsonProperty("total") Long total, @JsonProperty("pending") Long pending) {
this.total = total;
this.pending = pending;
}
public long getTotal() {
return total;
}
public long getPending() {
return pending;
}
}
static public class BucketSpaceStats {
private final String name;
@JsonProperty("buckets")
private BucketStats bucketStats = null;
@JsonCreator
public BucketSpaceStats(@JsonProperty("name") String name) {
this.name = name;
}
public String getName() {
return name;
}
public boolean valid() {
return bucketStats != null;
}
public BucketStats getBucketStats() {
return bucketStats;
}
}
private final Integer index;
// If a Distributor does not manage any bucket copies for a particular storage node,
// then the distributor will not return any min-current-replication-factor for that
// storage node.
@JsonProperty("min-current-replication-factor")
private Integer minCurrentReplicationFactor;
@JsonProperty("bucket-spaces")
private List<BucketSpaceStats> bucketSpacesStats = new ArrayList<>();
@JsonCreator
public StorageNode(@JsonProperty("node-index") Integer index) {
this.index = index;
}
public Integer getIndex() {
return index;
}
// See documentation on minCurrentReplicationFactor.
public Integer getMinCurrentReplicationFactorOrNull() {
return minCurrentReplicationFactor;
}
public List<BucketSpaceStats> getBucketSpacesStats() {
return bucketSpacesStats;
}
}
|