MCPcopy Index your code
hub / github.com/containerd/containerd / Push

Method Push

core/transfer/local/push.go:148–173  ·  view source on GitHub ↗
(ctx context.Context, d ocispec.Descriptor)

Source from the content-addressed store, hash-verified

146}
147
148func (p *progressPusher) Push(ctx context.Context, d ocispec.Descriptor) (content.Writer, error) {
149 ref := remotes.MakeRefKey(ctx, d)
150 p.status.add(ref, d)
151 var cw content.Writer
152 var err error
153 if cs, ok := p.Pusher.(content.Ingester); ok {
154 cw, err = content.OpenWriter(ctx, cs, content.WithRef(ref), content.WithDescriptor(d))
155 } else {
156 cw, err = p.Pusher.Push(ctx, d)
157 }
158 if err != nil {
159 if errdefs.IsAlreadyExists(err) {
160 p.progress.MarkExists(d)
161 p.status.markComplete(ref, d)
162 }
163 return nil, err
164 }
165
166 return &progressWriter{
167 Writer: cw,
168 ref: ref,
169 desc: d,
170 status: p.status,
171 progress: p.progress,
172 }, nil
173}
174
175func (ps *pushStatus) update(ref string, delta int) {
176 ps.l.Lock()

Callers

nothing calls this directly

Calls 8

MakeRefKeyFunction · 0.92
OpenWriterFunction · 0.92
WithRefFunction · 0.92
WithDescriptorFunction · 0.92
MarkExistsMethod · 0.80
markCompleteMethod · 0.80
PushMethod · 0.65
addMethod · 0.45

Tested by

no test coverage detected