MCPcopy
hub / github.com/moby/moby / SetParent

Method SetParent

daemon/containerd/cache.go:116–136  ·  view source on GitHub ↗
(target, parent image.ID)

Source from the content-addressed store, hash-verified

114}
115
116func (c cacheAdaptor) SetParent(target, parent image.ID) error {
117 ctx := context.TODO()
118 _, imgs, err := c.is.resolveAllReferences(ctx, target.String())
119 if err != nil {
120 return fmt.Errorf("failed to list images with digest %q", target)
121 }
122
123 var errs []error
124 is := c.is.images
125 for _, img := range imgs {
126 if img.Labels == nil {
127 img.Labels = make(map[string]string)
128 }
129 img.Labels[imageLabelClassicBuilderParent] = parent.String()
130 if _, err := is.Update(ctx, img, "labels."+imageLabelClassicBuilderParent); err != nil {
131 errs = append(errs, fmt.Errorf("failed to update parent label on image %v: %w", img, err))
132 }
133 }
134
135 return multierror.Join(errs...)
136}
137
138func (c cacheAdaptor) GetParent(target image.ID) (image.ID, error) {
139 ctx := context.TODO()

Callers

nothing calls this directly

Calls 5

JoinFunction · 0.92
resolveAllReferencesMethod · 0.80
ErrorfMethod · 0.80
StringMethod · 0.65
UpdateMethod · 0.65

Tested by

no test coverage detected