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

Method UpdateProgress

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

Source from the content-addressed store, hash-verified

120}
121
122func (p *pullProgress) UpdateProgress(ctx context.Context, ongoing *jobs, out progress.Output, start time.Time) error {
123 actives, err := p.store.ListStatuses(ctx, "")
124 if err != nil {
125 if errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) {
126 return err
127 }
128 log.G(ctx).WithError(err).Error("status check failed")
129 return nil
130 }
131 pulling := make(map[string]content.Status, len(actives))
132
133 // update status of status entries!
134 for _, status := range actives {
135 pulling[status.Ref] = status
136 }
137
138 for _, j := range ongoing.Jobs() {
139 if p.hideLayers {
140 ongoing.Remove(j)
141 continue
142 }
143 key := remotes.MakeRefKey(ctx, j)
144 if info, ok := pulling[key]; ok {
145 if info.Offset == 0 {
146 continue
147 }
148 out.WriteProgress(progress.Progress{
149 ID: stringid.TruncateID(j.Digest.Encoded()),
150 Action: "Downloading",
151 Current: info.Offset,
152 Total: info.Total,
153 })
154 continue
155 }
156
157 info, err := p.store.Info(ctx, j.Digest)
158 if err != nil {
159 if !cerrdefs.IsNotFound(err) {
160 return err
161 }
162 } else if info.CreatedAt.After(start) {
163 out.WriteProgress(progress.Progress{
164 ID: stringid.TruncateID(j.Digest.Encoded()),
165 Action: "Download complete",
166 HideCounts: true,
167 })
168 p.finished(ctx, out, j)
169 ongoing.Remove(j)
170 } else if p.showExists {
171 out.WriteProgress(progress.Progress{
172 ID: stringid.TruncateID(j.Digest.Encoded()),
173 Action: "Already exists",
174 HideCounts: true,
175 })
176 p.finished(ctx, out, j)
177 ongoing.Remove(j)
178 }
179 }

Callers

nothing calls this directly

Calls 10

finishedMethod · 0.95
TruncateIDFunction · 0.92
findMatchingSnapshotFunction · 0.85
JobsMethod · 0.80
RemoveMethod · 0.65
WriteProgressMethod · 0.65
InfoMethod · 0.65
ListStatusesMethod · 0.45
IsMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected