You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
go-zero/core/stores/cache/util.go

24 lines
376 B
Go

package cache
4 years ago
import "strings"
const keySeparator = ","
// TotalWeights returns the total weights of given nodes.
4 years ago
func TotalWeights(c []NodeConf) int {
var weights int
for _, node := range c {
if node.Weight < 0 {
node.Weight = 0
}
weights += node.Weight
}
return weights
}
func formatKeys(keys []string) string {
return strings.Join(keys, keySeparator)
}