(ctx context.Context, d ocispec.Descriptor)
| 146 | } |
| 147 | |
| 148 | func (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 | |
| 175 | func (ps *pushStatus) update(ref string, delta int) { |
| 176 | ps.l.Lock() |
nothing calls this directly
no test coverage detected