Merge pull request #3830 from MichaelEischer/cleanup-repo

Extract Load/SaveTree/JSONUnpacked from repository
This commit is contained in:
MichaelEischer
2022-07-23 10:46:13 +02:00
committed by GitHub
37 changed files with 274 additions and 254 deletions

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)

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)
}
@@ -137,7 +137,7 @@ func saveSnapshot(t testing.TB, repo restic.Repository, snapshot Snapshot) (*res
}
sn.Tree = &treeID
id, err := repo.SaveJSONUnpacked(ctx, restic.SnapshotFile, sn)
id, err := restic.SaveSnapshot(ctx, repo, sn)
if err != nil {
t.Fatal(err)
}