MCPcopy Index your code
hub / github.com/moby/moby / UpdateProgress

Method UpdateProgress

daemon/containerd/progress.go:282–330  ·  view source on GitHub ↗
(ctx context.Context, ongoing *jobs, out progress.Output, start time.Time)

Source from the content-addressed store, hash-verified

280}
281
282func (p *pushProgress) UpdateProgress(ctx context.Context, ongoing *jobs, out progress.Output, start time.Time) error {
283 for _, j := range ongoing.Jobs() {
284 key := remotes.MakeRefKey(ctx, j)
285 id := stringid.TruncateID(j.Digest.Encoded())
286
287 status, err := p.Tracker.GetStatus(key)
288
289 notStarted := (status.Total > 0 && status.Offset == 0)
290 if err != nil || notStarted {
291 if p.notStartedWaitingAreUnavailable.Load() {
292 progress.Update(out, id, "Unavailable")
293 continue
294 }
295 if cerrdefs.IsNotFound(err) {
296 progress.Update(out, id, "Waiting")
297 continue
298 }
299 }
300
301 if status.Committed && status.Offset >= status.Total {
302 if status.MountedFrom != "" {
303 from := status.MountedFrom
304 if ref, err := reference.ParseNormalizedNamed(from); err == nil {
305 from = reference.Path(ref)
306 }
307 progress.Update(out, id, "Mounted from "+from)
308 } else if status.Exists {
309 if c8dimages.IsLayerType(j.MediaType) {
310 progress.Update(out, id, "Layer already exists")
311 } else {
312 progress.Update(out, id, "Already exists")
313 }
314 } else {
315 progress.Update(out, id, "Pushed")
316 }
317 ongoing.Remove(j)
318 continue
319 }
320
321 out.WriteProgress(progress.Progress{
322 ID: id,
323 Action: "Pushing",
324 Current: status.Offset,
325 Total: status.Total,
326 })
327 }
328
329 return nil
330}
331
332type combinedProgress []progressUpdater
333

Callers

nothing calls this directly

Calls 7

TruncateIDFunction · 0.92
UpdateFunction · 0.92
JobsMethod · 0.80
LoadMethod · 0.65
PathMethod · 0.65
RemoveMethod · 0.65
WriteProgressMethod · 0.65

Tested by

no test coverage detected