ui/backup: remove unused parameter from ProgressPrinter interface
This commit is contained in:
parent
472bf5184f
commit
b0a01ae68a
4 changed files with 21 additions and 21 deletions
|
@ -99,7 +99,7 @@ func (b *JSONProgress) Error(item string, err error) error {
|
||||||
|
|
||||||
// CompleteItem is the status callback function for the archiver when a
|
// CompleteItem is the status callback function for the archiver when a
|
||||||
// file/dir has been saved successfully.
|
// file/dir has been saved successfully.
|
||||||
func (b *JSONProgress) CompleteItem(messageType, item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration) {
|
func (b *JSONProgress) CompleteItem(messageType, item string, s archiver.ItemStats, d time.Duration) {
|
||||||
if b.v < 2 {
|
if b.v < 2 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -161,7 +161,7 @@ func (b *JSONProgress) CompleteItem(messageType, item string, previous, current
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReportTotal sets the total stats up to now
|
// ReportTotal sets the total stats up to now
|
||||||
func (b *JSONProgress) ReportTotal(item string, start time.Time, s archiver.ScanStats) {
|
func (b *JSONProgress) ReportTotal(start time.Time, s archiver.ScanStats) {
|
||||||
if b.v >= 2 {
|
if b.v >= 2 {
|
||||||
b.print(verboseUpdate{
|
b.print(verboseUpdate{
|
||||||
MessageType: "verbose_status",
|
MessageType: "verbose_status",
|
||||||
|
|
|
@ -15,8 +15,8 @@ type ProgressPrinter interface {
|
||||||
Update(total, processed Counter, errors uint, currentFiles map[string]struct{}, start time.Time, secs uint64)
|
Update(total, processed Counter, errors uint, currentFiles map[string]struct{}, start time.Time, secs uint64)
|
||||||
Error(item string, err error) error
|
Error(item string, err error) error
|
||||||
ScannerError(item string, err error) error
|
ScannerError(item string, err error) error
|
||||||
CompleteItem(messageType string, item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration)
|
CompleteItem(messageType string, item string, s archiver.ItemStats, d time.Duration)
|
||||||
ReportTotal(item string, start time.Time, s archiver.ScanStats)
|
ReportTotal(start time.Time, s archiver.ScanStats)
|
||||||
Finish(snapshotID restic.ID, start time.Time, summary *Summary, dryRun bool)
|
Finish(snapshotID restic.ID, start time.Time, summary *Summary, dryRun bool)
|
||||||
Reset()
|
Reset()
|
||||||
|
|
||||||
|
@ -144,19 +144,19 @@ func (p *Progress) CompleteItem(item string, previous, current *restic.Node, s a
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case previous == nil:
|
case previous == nil:
|
||||||
p.printer.CompleteItem("dir new", item, previous, current, s, d)
|
p.printer.CompleteItem("dir new", item, s, d)
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
p.summary.Dirs.New++
|
p.summary.Dirs.New++
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
|
|
||||||
case previous.Equals(*current):
|
case previous.Equals(*current):
|
||||||
p.printer.CompleteItem("dir unchanged", item, previous, current, s, d)
|
p.printer.CompleteItem("dir unchanged", item, s, d)
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
p.summary.Dirs.Unchanged++
|
p.summary.Dirs.Unchanged++
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
p.printer.CompleteItem("dir modified", item, previous, current, s, d)
|
p.printer.CompleteItem("dir modified", item, s, d)
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
p.summary.Dirs.Changed++
|
p.summary.Dirs.Changed++
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
|
@ -170,19 +170,19 @@ func (p *Progress) CompleteItem(item string, previous, current *restic.Node, s a
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case previous == nil:
|
case previous == nil:
|
||||||
p.printer.CompleteItem("file new", item, previous, current, s, d)
|
p.printer.CompleteItem("file new", item, s, d)
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
p.summary.Files.New++
|
p.summary.Files.New++
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
|
|
||||||
case previous.Equals(*current):
|
case previous.Equals(*current):
|
||||||
p.printer.CompleteItem("file unchanged", item, previous, current, s, d)
|
p.printer.CompleteItem("file unchanged", item, s, d)
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
p.summary.Files.Unchanged++
|
p.summary.Files.Unchanged++
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
|
|
||||||
default:
|
default:
|
||||||
p.printer.CompleteItem("file modified", item, previous, current, s, d)
|
p.printer.CompleteItem("file modified", item, s, d)
|
||||||
p.mu.Lock()
|
p.mu.Lock()
|
||||||
p.summary.Files.Changed++
|
p.summary.Files.Changed++
|
||||||
p.mu.Unlock()
|
p.mu.Unlock()
|
||||||
|
@ -200,7 +200,7 @@ func (p *Progress) ReportTotal(item string, s archiver.ScanStats) {
|
||||||
|
|
||||||
if item == "" {
|
if item == "" {
|
||||||
p.scanFinished = true
|
p.scanFinished = true
|
||||||
p.printer.ReportTotal(item, p.start, s)
|
p.printer.ReportTotal(p.start, s)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,12 @@ type mockPrinter struct {
|
||||||
id restic.ID
|
id restic.ID
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *mockPrinter) Update(total, processed Counter, errors uint, currentFiles map[string]struct{}, start time.Time, secs uint64) {
|
func (p *mockPrinter) Update(_, _ Counter, _ uint, _ map[string]struct{}, _ time.Time, _ uint64) {
|
||||||
}
|
}
|
||||||
func (p *mockPrinter) Error(item string, err error) error { return err }
|
func (p *mockPrinter) Error(_ string, err error) error { return err }
|
||||||
func (p *mockPrinter) ScannerError(item string, err error) error { return err }
|
func (p *mockPrinter) ScannerError(_ string, err error) error { return err }
|
||||||
|
|
||||||
func (p *mockPrinter) CompleteItem(messageType string, item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration) {
|
func (p *mockPrinter) CompleteItem(messageType string, _ string, _ archiver.ItemStats, _ time.Duration) {
|
||||||
p.Lock()
|
p.Lock()
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
|
@ -32,8 +32,8 @@ func (p *mockPrinter) CompleteItem(messageType string, item string, previous, cu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *mockPrinter) ReportTotal(_ string, _ time.Time, _ archiver.ScanStats) {}
|
func (p *mockPrinter) ReportTotal(_ time.Time, _ archiver.ScanStats) {}
|
||||||
func (p *mockPrinter) Finish(id restic.ID, _ time.Time, summary *Summary, dryRun bool) {
|
func (p *mockPrinter) Finish(id restic.ID, _ time.Time, summary *Summary, _ bool) {
|
||||||
p.Lock()
|
p.Lock()
|
||||||
defer p.Unlock()
|
defer p.Unlock()
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@ func (p *mockPrinter) Finish(id restic.ID, _ time.Time, summary *Summary, dryRun
|
||||||
|
|
||||||
func (p *mockPrinter) Reset() {}
|
func (p *mockPrinter) Reset() {}
|
||||||
|
|
||||||
func (p *mockPrinter) P(msg string, args ...interface{}) {}
|
func (p *mockPrinter) P(_ string, _ ...interface{}) {}
|
||||||
func (p *mockPrinter) V(msg string, args ...interface{}) {}
|
func (p *mockPrinter) V(_ string, _ ...interface{}) {}
|
||||||
|
|
||||||
func TestProgress(t *testing.T) {
|
func TestProgress(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
|
@ -85,7 +85,7 @@ func (b *TextProgress) Error(_ string, err error) error {
|
||||||
|
|
||||||
// CompleteItem is the status callback function for the archiver when a
|
// CompleteItem is the status callback function for the archiver when a
|
||||||
// file/dir has been saved successfully.
|
// file/dir has been saved successfully.
|
||||||
func (b *TextProgress) CompleteItem(messageType, item string, previous, current *restic.Node, s archiver.ItemStats, d time.Duration) {
|
func (b *TextProgress) CompleteItem(messageType, item string, s archiver.ItemStats, d time.Duration) {
|
||||||
item = termstatus.Quote(item)
|
item = termstatus.Quote(item)
|
||||||
|
|
||||||
switch messageType {
|
switch messageType {
|
||||||
|
@ -111,7 +111,7 @@ func (b *TextProgress) CompleteItem(messageType, item string, previous, current
|
||||||
}
|
}
|
||||||
|
|
||||||
// ReportTotal sets the total stats up to now
|
// ReportTotal sets the total stats up to now
|
||||||
func (b *TextProgress) ReportTotal(item string, start time.Time, s archiver.ScanStats) {
|
func (b *TextProgress) ReportTotal(start time.Time, s archiver.ScanStats) {
|
||||||
b.V("scan finished in %.3fs: %v files, %s",
|
b.V("scan finished in %.3fs: %v files, %s",
|
||||||
time.Since(start).Seconds(),
|
time.Since(start).Seconds(),
|
||||||
s.Files, ui.FormatBytes(s.Bytes),
|
s.Files, ui.FormatBytes(s.Bytes),
|
||||||
|
|
Loading…
Reference in a new issue