[TrueCloudLab/hrw#2] sdk-go: Use typed HRW methods

Update HRW pkg and use typed HRW methods to sort nodes

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
Dmitrii Stepanov 2023-02-28 14:04:02 +03:00 committed by fyrchik
parent e355e5eeba
commit 2cbc585edd
5 changed files with 8 additions and 6 deletions

View file

@ -108,7 +108,7 @@ func (c *context) getSelection(p PlacementPolicy, s netmap.Selector) ([]nodes, e
weights[i] = calcBucketWeight(res[i], newMeanIQRAgg(), c.weightFunc)
}
hrw.SortSliceByWeightValue(res, weights, c.hrwSeedHash)
hrw.SortHasherSliceByWeightValue(res, weights, c.hrwSeedHash)
}
if s.GetAttribute() == "" {
@ -164,7 +164,7 @@ func (c *context) getSelectionBase(subnetID subnetid.ID, s netmap.Selector) []no
if len(c.hrwSeed) != 0 {
for i := range result {
hrw.SortSliceByWeightValue(result[i].nodes, result[i].nodes.weights(c.weightFunc), c.hrwSeedHash)
hrw.SortHasherSliceByWeightValue(result[i].nodes, result[i].nodes.weights(c.weightFunc), c.hrwSeedHash)
}
}