mirror of
https://github.com/octoleo/restic.git
synced 2025-01-11 10:18:10 +00:00
make statsWalkSnapshot return a function
This commit is contained in:
parent
daca9d6815
commit
12c797700e
@ -147,16 +147,15 @@ func statsWalkSnapshot(ctx context.Context, snapshot *restic.Snapshot, repo rest
|
|||||||
return restic.FindUsedBlobs(ctx, repo, *snapshot.Tree, stats.blobs, stats.blobsSeen)
|
return restic.FindUsedBlobs(ctx, repo, *snapshot.Tree, stats.blobs, stats.blobsSeen)
|
||||||
}
|
}
|
||||||
|
|
||||||
err := walker.Walk(ctx, repo, *snapshot.Tree, restic.NewIDSet(), func(path string, node *restic.Node, nodeErr error) (bool, error) {
|
err := walker.Walk(ctx, repo, *snapshot.Tree, restic.NewIDSet(), statsWalkTree(repo, stats))
|
||||||
return statsWalkTree(path, node, nodeErr, repo, stats)
|
|
||||||
})
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("walking tree %s: %v", *snapshot.Tree, err)
|
return fmt.Errorf("walking tree %s: %v", *snapshot.Tree, err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func statsWalkTree(npath string, node *restic.Node, nodeErr error, repo restic.Repository, stats *statsContainer) (ignore bool, err error) {
|
func statsWalkTree(repo restic.Repository, stats *statsContainer) walker.WalkFunc {
|
||||||
|
return func(npath string, node *restic.Node, nodeErr error) (bool, error) {
|
||||||
if nodeErr != nil {
|
if nodeErr != nil {
|
||||||
return true, nodeErr
|
return true, nodeErr
|
||||||
}
|
}
|
||||||
@ -217,6 +216,7 @@ func statsWalkTree(npath string, node *restic.Node, nodeErr error, repo restic.R
|
|||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// makeFileIDByContents returns a hash of the blob IDs of the
|
// makeFileIDByContents returns a hash of the blob IDs of the
|
||||||
// node's Content in sequence.
|
// node's Content in sequence.
|
||||||
|
Loading…
Reference in New Issue
Block a user