repository: extract LoadTree/SaveTree

The repository has no real idea what a Tree is. So these methods never
belonged there.
This commit is contained in:
Michael Eischer committed 2022-07-17 13:11:28 +02:00
1 parent d9ea1e9ee2
commit fbcbd5318c
22 files changed
+150 -133

No files matched your search

+1 -1
View File
@@ -53,7 +53,7 @@ type treeVisitor struct {
// target is the path in the file system, location within the snapshot.
func (res *Restorer) traverseTree(ctx context.Context, target, location string, treeID restic.ID, visitor treeVisitor) (hasRestored bool, err error) {
debug.Log("%v %v %v", target, location, treeID)
tree, err := res.repo.LoadTree(ctx, treeID)
tree, err := restic.LoadTree(ctx, res.repo, treeID)
if err != nil {
debug.Log("error loading tree %v: %v", treeID, err)
return hasRestored, res.Error(location, err)
+1 -1
View File
@@ -111,7 +111,7 @@ func saveDir(t testing.TB, repo restic.Repository, nodes map[string]Node, inode
}
}
id, err := repo.SaveTree(ctx, tree)
id, err := restic.SaveTree(ctx, repo, tree)
if err != nil {
t.Fatal(err)
}