(originLabel, repo string)
| 77 | } |
| 78 | |
| 79 | func appendDistributionSourceLabel(originLabel, repo string) string { |
| 80 | repos := []string{} |
| 81 | if originLabel != "" { |
| 82 | repos = strings.Split(originLabel, ",") |
| 83 | } |
| 84 | repos = append(repos, repo) |
| 85 | |
| 86 | // use empty string to present duplicate items |
| 87 | for i := 1; i < len(repos); i++ { |
| 88 | tmp, j := repos[i], i-1 |
| 89 | for ; j >= 0 && repos[j] >= tmp; j-- { |
| 90 | if repos[j] == tmp { |
| 91 | tmp = "" |
| 92 | } |
| 93 | repos[j+1] = repos[j] |
| 94 | } |
| 95 | repos[j+1] = tmp |
| 96 | } |
| 97 | |
| 98 | i := 0 |
| 99 | for ; i < len(repos) && repos[i] == ""; i++ { |
| 100 | } |
| 101 | |
| 102 | return strings.Join(repos[i:], ",") |
| 103 | } |
| 104 | |
| 105 | func distributionSourceLabelKey(source string) string { |
| 106 | return labels.LabelDistributionSource + "." + source |
no outgoing calls
searching dependent graphs…