Use LRU cache in restic dump

This commit is contained in:
greatroar
2021-09-24 15:45:08 +02:00
parent 718966a81a
commit fe04d024c7
6 changed files with 55 additions and 26 deletions
+2 -1
View File
@@ -95,7 +95,8 @@ func printFromTree(ctx context.Context, tree *restic.Tree, repo restic.Repositor
if node.Name == pathComponents[0] {
switch {
case l == 1 && dump.IsFile(node):
return dump.GetNodeData(ctx, os.Stdout, repo, node)
cache := dump.NewCache()
return dump.WriteNodeData(ctx, os.Stdout, repo, node, cache)
case l > 1 && dump.IsDir(node):
subtree, err := repo.LoadTree(ctx, *node.Subtree)
if err != nil {