diff --git a/pkg/image/docker/pull_status.go b/pkg/image/docker/pull_status.go index 76272ec9..34a889b4 100644 --- a/pkg/image/docker/pull_status.go +++ b/pkg/image/docker/pull_status.go @@ -122,17 +122,17 @@ func (p *PullStatus) onEvent(event *pullEvent) { if currentPhase >= AlreadyExistsPhase { phaseProgress.SetCompleted() } else { - phaseProgress.N = int64(event.ProgressDetail.Current) - phaseProgress.Total = int64(event.ProgressDetail.Total) + phaseProgress.Set(int64(event.ProgressDetail.Current)) + phaseProgress.SetTotal(int64(event.ProgressDetail.Total)) } if currentPhase == DownloadingPhase { dl := p.downloadProgress[layer] - dl.N = int64(event.ProgressDetail.Current) - dl.Total = int64(event.ProgressDetail.Total) + dl.Set(int64(event.ProgressDetail.Current)) + dl.SetTotal(int64(event.ProgressDetail.Total)) } else if currentPhase >= DownloadCompletePhase { dl := p.downloadProgress[layer] - dl.N = dl.Total + dl.Set(dl.Size()) dl.SetCompleted() } } diff --git a/pkg/image/image.go b/pkg/image/image.go index 9798197b..b8a34b5c 100644 --- a/pkg/image/image.go +++ b/pkg/image/image.go @@ -155,10 +155,10 @@ func (i *Image) IDs() []string { } func (i *Image) trackReadProgress(metadata Metadata) *progress.Manual { - prog := &progress.Manual{ + prog := progress.NewManual( // x2 for read and squash of each layer - Total: int64(len(metadata.Config.RootFS.DiffIDs) * 2), - } + int64(len(metadata.Config.RootFS.DiffIDs) * 2), + ) bus.Publish(partybus.Event{ Type: event.ReadImage, @@ -217,7 +217,7 @@ func (i *Image) Read() error { i.Metadata.Size += layer.Metadata.Size layers = append(layers, layer) - readProg.N++ + readProg.Increment() } i.Layers = layers @@ -257,7 +257,7 @@ func (i *Image) squash(prog *progress.Manual) error { layer.SquashedSearchContext = filetree.NewSearchContext(layer.SquashedTree, layer.fileCatalog.Index) lastSquashTree = squashedTree - prog.N++ + prog.Increment() } prog.SetCompleted() diff --git a/pkg/image/layer.go b/pkg/image/layer.go index f0b1267d..df202cd4 100644 --- a/pkg/image/layer.go +++ b/pkg/image/layer.go @@ -240,7 +240,7 @@ func layerTarIndexer(ft filetree.Writer, fileCatalog *FileCatalog, size *int64, fileCatalog.addImageReferences(ref.ID(), layerRef, index.Open) if monitor != nil { - monitor.N++ + monitor.Increment() } return nil } @@ -285,7 +285,7 @@ func squashfsVisitor(ft filetree.Writer, fileCatalog *FileCatalog, size *int64, return r }) - monitor.N++ + monitor.Increment() return nil } }