diff --git a/cmd/restic/cmd_stats.go b/cmd/restic/cmd_stats.go index 408579cf7..265c03c5f 100644 --- a/cmd/restic/cmd_stats.go +++ b/cmd/restic/cmd_stats.go @@ -13,7 +13,6 @@ import ( "github.com/restic/restic/internal/global" "github.com/restic/restic/internal/repository" "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" statsui "github.com/restic/restic/internal/ui/stats" @@ -228,7 +227,7 @@ func statsWalkSnapshot(ctx context.Context, snapshot *data.Snapshot, repo restic return data.FindUsedBlobs(ctx, repo, restic.IDs{*snapshot.Tree}, stats.blobs, restic.NoopCounter) } - hardLinkIndex := restorer.NewHardlinkIndex[struct{}]() + hardLinkIndex := data.NewHardlinkIndex[struct{}]() err := walker.Walk(ctx, repo, *snapshot.Tree, walker.WalkVisitor{ ProcessNode: statsWalkTree(repo, opts, stats, hardLinkIndex, sp), }) @@ -239,7 +238,7 @@ func statsWalkSnapshot(ctx context.Context, snapshot *data.Snapshot, repo restic return nil } -func statsWalkTree(repo restic.Loader, opts StatsOptions, stats *statsContainer, hardLinkIndex *restorer.HardlinkIndex[struct{}], progress *statsui.Progress) walker.WalkFunc { +func statsWalkTree(repo restic.Loader, opts StatsOptions, stats *statsContainer, hardLinkIndex *data.HardlinkIndex[struct{}], progress *statsui.Progress) walker.WalkFunc { return func(parentTreeID restic.ID, npath string, node *data.Node, nodeErr error) error { if nodeErr != nil { return nodeErr diff --git a/internal/restorer/hardlinks_index.go b/internal/data/hardlinks_index.go similarity index 98% rename from internal/restorer/hardlinks_index.go rename to internal/data/hardlinks_index.go index ec6c33a50..2cd344810 100644 --- a/internal/restorer/hardlinks_index.go +++ b/internal/data/hardlinks_index.go @@ -1,4 +1,4 @@ -package restorer +package data import ( "sync" diff --git a/internal/restorer/hardlinks_index_test.go b/internal/data/hardlinks_index_test.go similarity index 84% rename from internal/restorer/hardlinks_index_test.go rename to internal/data/hardlinks_index_test.go index 31ce938f9..4aa868c07 100644 --- a/internal/restorer/hardlinks_index_test.go +++ b/internal/data/hardlinks_index_test.go @@ -1,16 +1,16 @@ -package restorer_test +package data_test import ( "testing" - "github.com/restic/restic/internal/restorer" + "github.com/restic/restic/internal/data" rtest "github.com/restic/restic/internal/test" ) // TestHardLinks contains various tests for HardlinkIndex. func TestHardLinks(t *testing.T) { - idx := restorer.NewHardlinkIndex[string]() + idx := data.NewHardlinkIndex[string]() idx.Add(1, 2, "inode1-file1-on-device2") idx.Add(2, 3, "inode2-file2-on-device3") diff --git a/internal/restorer/restorer.go b/internal/restorer/restorer.go index 8741522e4..9f2a13658 100644 --- a/internal/restorer/restorer.go +++ b/internal/restorer/restorer.go @@ -360,7 +360,7 @@ func (res *Restorer) RestoreTo(ctx context.Context, dst string) (uint64, error) } } - idx := NewHardlinkIndex[string]() + idx := data.NewHardlinkIndex[string]() filerestorer := newFileRestorer(dst, res.repo.LoadBlobsFromPack, res.repo.LookupBlob, res.repo.Connections(), res.opts.Sparse, res.opts.Delete, res.repo.StartWarmup, res.opts.Progress) filerestorer.Error = res.Error diff --git a/internal/restorer/restorer_unix_test.go b/internal/restorer/restorer_unix_test.go index 7b94ee212..bb31b8bf0 100644 --- a/internal/restorer/restorer_unix_test.go +++ b/internal/restorer/restorer_unix_test.go @@ -4,7 +4,6 @@ package restorer import ( "context" - "github.com/restic/restic/internal/restic" "io/fs" "os" "path/filepath" @@ -13,8 +12,8 @@ import ( "time" "github.com/restic/restic/internal/repository" + "github.com/restic/restic/internal/restic" rtest "github.com/restic/restic/internal/test" - "github.com/restic/restic/internal/ui/progress" restoreui "github.com/restic/restic/internal/ui/restore" ) diff --git a/internal/ui/restore/progress_test.go b/internal/ui/restore/progress_test.go index 1259636ab..3107a72e3 100644 --- a/internal/ui/restore/progress_test.go +++ b/internal/ui/restore/progress_test.go @@ -1,13 +1,12 @@ package restore import ( - "github.com/restic/restic/internal/restic" "testing" "time" "github.com/restic/restic/internal/errors" + "github.com/restic/restic/internal/restic" "github.com/restic/restic/internal/test" - "github.com/restic/restic/internal/ui/progress" ) type printerTraceEntry struct {