[#227] netmap: Do not export bucket weight calculator
`GetBucketWeight` is not usable outside placement context. Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
86bdc670d5
commit
5bfdb64251
2 changed files with 3 additions and 3 deletions
|
@ -74,8 +74,8 @@ const (
|
||||||
AttrContinent = "Continent"
|
AttrContinent = "Continent"
|
||||||
)
|
)
|
||||||
|
|
||||||
// GetBucketWeight computes weight for a Bucket.
|
// calcBucketWeight computes weight for a Bucket.
|
||||||
func GetBucketWeight(ns nodes, a aggregator, wf weightFunc) float64 {
|
func calcBucketWeight(ns nodes, a aggregator, wf weightFunc) float64 {
|
||||||
for i := range ns {
|
for i := range ns {
|
||||||
a.Add(wf(ns[i]))
|
a.Add(wf(ns[i]))
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,7 +97,7 @@ func (c *context) getSelection(p *PlacementPolicy, s *Selector) ([]nodes, error)
|
||||||
if len(c.pivot) != 0 {
|
if len(c.pivot) != 0 {
|
||||||
weights := make([]float64, len(res))
|
weights := make([]float64, len(res))
|
||||||
for i := range res {
|
for i := range res {
|
||||||
weights[i] = GetBucketWeight(res[i], c.aggregator(), c.weightFunc)
|
weights[i] = calcBucketWeight(res[i], c.aggregator(), c.weightFunc)
|
||||||
}
|
}
|
||||||
|
|
||||||
hrw.SortSliceByWeightValue(res, weights, c.pivotHash)
|
hrw.SortSliceByWeightValue(res, weights, c.pivotHash)
|
||||||
|
|
Loading…
Reference in a new issue