2
2
mirror of https://github.com/octoleo/restic.git synced 2024-11-29 08:14:03 +00:00

Remove unused Writer arg to internal/dump.writeDump

This commit is contained in:
greatroar 2021-09-24 12:52:27 +02:00
parent 8b758c78a3
commit 4f33eca634
4 changed files with 5 additions and 7 deletions

View File

@ -16,11 +16,7 @@ type dumper interface {
dumpNode(ctx context.Context, node *restic.Node, repo restic.Repository) error
}
// WriteDump will write the contents of the given tree to the given destination.
// It will loop over all nodes in the tree and dump them recursively.
type WriteDump func(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dst io.Writer) error
func writeDump(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dmp dumper, dst io.Writer) error {
func writeDump(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dmp dumper) error {
for _, rootNode := range tree.Nodes {
rootNode.Path = rootPath
err := dumpTree(ctx, repo, rootNode, rootPath, dmp)

View File

@ -3,6 +3,7 @@ package dump
import (
"bytes"
"context"
"io"
"testing"
"github.com/restic/restic/internal/archiver"
@ -27,6 +28,7 @@ func prepareTempdirRepoSrc(t testing.TB, src archiver.TestDir) (tempdir string,
}
type CheckDump func(t *testing.T, testDir string, testDump *bytes.Buffer) error
type WriteDump func(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dst io.Writer) error
func WriteTest(t *testing.T, wd WriteDump, cd CheckDump) {
tests := []struct {

View File

@ -23,7 +23,7 @@ var _ dumper = tarDumper{}
func WriteTar(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dst io.Writer) error {
dmp := tarDumper{w: tar.NewWriter(dst)}
return writeDump(ctx, repo, tree, rootPath, dmp, dst)
return writeDump(ctx, repo, tree, rootPath, dmp)
}
func (dmp tarDumper) Close() error {

View File

@ -21,7 +21,7 @@ var _ dumper = zipDumper{}
func WriteZip(ctx context.Context, repo restic.Repository, tree *restic.Tree, rootPath string, dst io.Writer) error {
dmp := zipDumper{w: zip.NewWriter(dst)}
return writeDump(ctx, repo, tree, rootPath, dmp, dst)
return writeDump(ctx, repo, tree, rootPath, dmp)
}
func (dmp zipDumper) Close() error {