From 86bdc670d5f43ca76cbf9115cc5d193c8799f498 Mon Sep 17 00:00:00 2001 From: Leonard Lyubich Date: Tue, 7 Jun 2022 09:01:25 +0300 Subject: [PATCH] [#227] netmap: Do not export default weightFunc initializer `GetDefaultWeightFunc` is not usable outside placement context. Signed-off-by: Leonard Lyubich --- netmap/context.go | 6 +++--- netmap/netmap.go | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/netmap/context.go b/netmap/context.go index 098e218d..e4674823 100644 --- a/netmap/context.go +++ b/netmap/context.go @@ -58,7 +58,7 @@ func newContext(nm *Netmap) *context { numCache: make(map[string]uint64), aggregator: newMeanIQRAgg, - weightFunc: GetDefaultWeightFunc(nm.nodes), + weightFunc: defaultWeightFunc(nm.nodes), cbf: defaultCBF, } } @@ -78,8 +78,8 @@ func (c *context) setCBF(cbf uint32) { } } -// GetDefaultWeightFunc returns default weighting function. -func GetDefaultWeightFunc(ns nodes) weightFunc { +// defaultWeightFunc returns default weighting function. +func defaultWeightFunc(ns nodes) weightFunc { mean := newMeanAgg() min := newMinAgg() diff --git a/netmap/netmap.go b/netmap/netmap.go index b8f11785..0572cc0c 100644 --- a/netmap/netmap.go +++ b/netmap/netmap.go @@ -146,7 +146,7 @@ func flattenNodes(ns []nodes) nodes { // GetPlacementVectors returns placement vectors for an object given containerNodes cnt. func (m *Netmap) GetPlacementVectors(vectors [][]NodeInfo, pivot []byte) ([][]NodeInfo, error) { h := hrw.Hash(pivot) - wf := GetDefaultWeightFunc(m.nodes) + wf := defaultWeightFunc(m.nodes) result := make([][]NodeInfo, len(vectors)) for i := range vectors {