ipfs-cluster: github.com/ipfs/ipfs-cluster/allocator/util Index | Files

package util

import "github.com/ipfs/ipfs-cluster/allocator/util"

Package util is a utility package used by the allocator implementations. This package provides the SortNumeric function, which may be used by an allocator to sort peers by their metric values (ascending or descending).


Package Files


func SortNumeric Uses

func SortNumeric(candidates map[peer.ID]*api.Metric, reverse bool) []peer.ID

SortNumeric returns a list of peers sorted by their metric values. If reverse is false (true), peers will be sorted from smallest to largest (largest to smallest) metric

Package util imports 4 packages (graph) and is imported by 2 packages. Updated 2019-06-26. Refresh now. Tools for package owners.