ui: restore a few comments

This commit is contained in:
Michael Eischer 2021-08-18 01:27:22 +02:00
parent 80cbaf6d38
commit 5ccf583b8a

View file

@ -65,6 +65,7 @@ type Summary struct {
archiver.ItemStats archiver.ItemStats
} }
// Progress reports progress for the `backup` command.
type Progress struct { type Progress struct {
MinUpdatePause time.Duration MinUpdatePause time.Duration
@ -100,6 +101,8 @@ func NewProgress(printer ProgressPrinter) *Progress {
} }
} }
// Run regularly updates the status lines. It should be called in a separate
// goroutine.
func (p *Progress) Run(ctx context.Context) error { func (p *Progress) Run(ctx context.Context) error {
var ( var (
lastUpdate time.Time lastUpdate time.Time
@ -309,9 +312,9 @@ func (p *Progress) ReportTotal(item string, s archiver.ScanStats) {
// Finish prints the finishing messages. // Finish prints the finishing messages.
func (p *Progress) Finish(snapshotID restic.ID) { func (p *Progress) Finish(snapshotID restic.ID) {
// wait for the status update goroutine to shut down
<-p.closed <-p.closed
summary := p.summary p.printer.Finish(snapshotID, p.start, p.summary)
p.printer.Finish(snapshotID, p.start, summary)
} }
// SetMinUpdatePause sets b.MinUpdatePause. It satisfies the // SetMinUpdatePause sets b.MinUpdatePause. It satisfies the