MCPcopy
hub / github.com/containerd/containerd / appendDistributionSourceLabel

Function appendDistributionSourceLabel

core/remotes/docker/handler.go:79–103  ·  view source on GitHub ↗
(originLabel, repo string)

Source from the content-addressed store, hash-verified

77}
78
79func 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
105func distributionSourceLabelKey(source string) string {
106 return labels.LabelDistributionSource + "." + source

Callers 2

Calls

no outgoing calls

Tested by 1

Used in the wild real call sites across dependent graphs

searching dependent graphs…