func makeRing(config []string) *hashing.HashRing { hr := hashing.NewHashRing() for _, n := range config { fields := strings.Split(n, ":") if len(fields) < 2 { fields = append(fields, uuid.New()) } else if fields[1] == "" { fields[1] = uuid.New() } hr.AddNode(hashing.NewNode(fields[0], fields[1])) } return hr }
func buildHashRing(rings []*JSONRingType) *hashing.HashRing { hr := hashing.NewHashRing() for _, n := range rings[0].Nodes { // ports are already removed fields := strings.Split(n, ":") if len(fields) < 2 { hr.AddNode(hashing.NewNode(fields[0], "")) } else { hr.AddNode(hashing.NewNode(fields[0], fields[1])) } } return hr }