@@ -36,20 +36,20 @@ type failureDomainAggregation struct {
36
36
type failureDomainAggregations []failureDomainAggregation
37
37
38
38
const (
39
- ASCENDING = iota
40
- DESCENDING
39
+ ascending = iota
40
+ descending
41
41
)
42
42
43
43
func (f failureDomainAggregations ) SortFunc (i , j failureDomainAggregation , order int ) int {
44
44
// If a failure domain has less priority machines then the other, it goes first
45
45
if i .countPriority < j .countPriority {
46
- if order == ASCENDING {
46
+ if order == ascending {
47
47
return - 1
48
48
}
49
49
return 1
50
50
}
51
51
if i .countPriority > j .countPriority {
52
- if order == ASCENDING {
52
+ if order == ascending {
53
53
return 1
54
54
}
55
55
return - 1
@@ -58,13 +58,13 @@ func (f failureDomainAggregations) SortFunc(i, j failureDomainAggregation, order
58
58
// If a failure domain has the same number of priority machines then the other,
59
59
// use the number of overall machines to pick which one goes first.
60
60
if i .countAll < j .countAll {
61
- if order == ASCENDING {
61
+ if order == ascending {
62
62
return - 1
63
63
}
64
64
return 1
65
65
}
66
66
if i .countAll > j .countAll {
67
- if order == ASCENDING {
67
+ if order == ascending {
68
68
return 1
69
69
}
70
70
return - 1
@@ -73,7 +73,7 @@ func (f failureDomainAggregations) SortFunc(i, j failureDomainAggregation, order
73
73
// If both failure domain have the same number of priority machines and overall machines, we keep the order
74
74
// in the list which ensure a certain degree of randomness because the list originates from a map.
75
75
// This helps to spread machines e.g. when concurrently working on many clusters.
76
- if order == ASCENDING {
76
+ if order == ascending {
77
77
return 1
78
78
}
79
79
return - 1
@@ -86,7 +86,7 @@ func PickMost(ctx context.Context, failureDomains []clusterv1.FailureDomain, all
86
86
return ""
87
87
}
88
88
slices .SortFunc (aggregations , func (i , j failureDomainAggregation ) int {
89
- return aggregations .SortFunc (i , j , DESCENDING )
89
+ return aggregations .SortFunc (i , j , descending )
90
90
})
91
91
if len (aggregations ) > 0 && aggregations [0 ].countPriority > 0 {
92
92
return aggregations [0 ].id
@@ -108,7 +108,7 @@ func PickFewest(ctx context.Context, failureDomains []clusterv1.FailureDomain, a
108
108
return ""
109
109
}
110
110
slices .SortFunc (aggregations , func (i , j failureDomainAggregation ) int {
111
- return aggregations .SortFunc (i , j , ASCENDING )
111
+ return aggregations .SortFunc (i , j , ascending )
112
112
})
113
113
return aggregations [0 ].id
114
114
}
0 commit comments