internal/restorer: invert dependency direction to ui/restorer

The restorer imported ui/restorer which leaks ui logic into the restorer
core. Swap the direction by letting the restorer use a ProgressReporter
interface + associated constants.
This commit is contained in:
Michael Eischer committed 2026-06-20 17:49:20 +02:00
1 parent 5cd39d01c1
commit 2f31cde517
12 files changed
+189 -116

No files matched your search

+8 -7
View File
@@ -4,6 +4,7 @@ import (
"time"
"github.com/restic/restic/internal/restic"
"github.com/restic/restic/internal/restorer"
"github.com/restic/restic/internal/ui"
"github.com/restic/restic/internal/ui/progress"
)
@@ -61,24 +62,24 @@ func (t *jsonPrinter) Error(item string, err error) error {
return nil
}
func (t *jsonPrinter) CompleteItem(messageType ItemAction, item string, size uint64) {
func (t *jsonPrinter) CompleteItem(messageType restorer.ItemAction, item string, size uint64) {
if t.verbosity < 3 {
return
}
var action string
switch messageType {
case ActionDirRestored:
case restorer.ActionDirRestored:
action = "restored"
case ActionFileRestored:
case restorer.ActionFileRestored:
action = "restored"
case ActionOtherRestored:
case restorer.ActionOtherRestored:
action = "restored"
case ActionFileUpdated:
case restorer.ActionFileUpdated:
action = "updated"
case ActionFileUnchanged:
case restorer.ActionFileUnchanged:
action = "unchanged"
case ActionDeleted:
case restorer.ActionDeleted:
action = "deleted"
default:
panic("unknown message type")