From 5bfdb64251b1d5eca27be4aa140d937ce6f699ad Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 7 Jun 2022 09:03:50 +0300 Subject: [PATCH] [#227] netmap: Do not export bucket weight calculator `GetBucketWeight` is not usable outside placement context. Signed-off-by: Leonard Lyubich --- netmap/node_info.go | 4 ++-- netmap/selector.go | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/netmap/node_info.go b/netmap/node_info.go index ee474f0b..a0cef193 100644 --- a/netmap/node_info.go +++ b/netmap/node_info.go @@ -74,8 +74,8 @@ const ( AttrContinent = "Continent" ) -// GetBucketWeight computes weight for a Bucket. -func GetBucketWeight(ns nodes, a aggregator, wf weightFunc) float64 { +// calcBucketWeight computes weight for a Bucket. +func calcBucketWeight(ns nodes, a aggregator, wf weightFunc) float64 { for i := range ns { a.Add(wf(ns[i])) } diff --git a/netmap/selector.go b/netmap/selector.go index cfeecd20..b723d19d 100644 --- a/netmap/selector.go +++ b/netmap/selector.go @@ -97,7 +97,7 @@ func (c *context) getSelection(p *PlacementPolicy, s *Selector) ([]nodes, error) if len(c.pivot) != 0 { weights := make([]float64, len(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)