2
2
mirror of https://github.com/octoleo/restic.git synced 2024-12-26 12:27:33 +00:00

Remove unused fs.FS from archiver.FileSaver

This commit is contained in:
greatroar 2020-02-17 00:21:37 +01:00
parent f2bf06a419
commit 2f8aa2ce30
3 changed files with 4 additions and 7 deletions

View File

@ -754,7 +754,6 @@ func (arch *Archiver) runWorkers(ctx context.Context, t *tomb.Tomb) {
arch.blobSaver = NewBlobSaver(ctx, t, arch.Repo, arch.Options.SaveBlobConcurrency)
arch.fileSaver = NewFileSaver(ctx, t,
arch.FS,
arch.blobSaver.Save,
arch.Repo.Config().ChunkerPolynomial,
arch.Options.FileReadConcurrency, arch.Options.SaveBlobConcurrency)

View File

@ -53,7 +53,6 @@ type SaveBlobFn func(context.Context, restic.BlobType, *Buffer) FutureBlob
// FileSaver concurrently saves incoming files to the repo.
type FileSaver struct {
fs fs.FS
saveFilePool *BufferPool
saveBlob SaveBlobFn
@ -69,7 +68,7 @@ type FileSaver struct {
// NewFileSaver returns a new file saver. A worker pool with fileWorkers is
// started, it is stopped when ctx is cancelled.
func NewFileSaver(ctx context.Context, t *tomb.Tomb, fs fs.FS, save SaveBlobFn, pol chunker.Pol, fileWorkers, blobWorkers uint) *FileSaver {
func NewFileSaver(ctx context.Context, t *tomb.Tomb, save SaveBlobFn, pol chunker.Pol, fileWorkers, blobWorkers uint) *FileSaver {
ch := make(chan saveFileJob)
debug.Log("new file saver with %v file workers and %v blob workers", fileWorkers, blobWorkers)
@ -77,7 +76,6 @@ func NewFileSaver(ctx context.Context, t *tomb.Tomb, fs fs.FS, save SaveBlobFn,
poolSize := fileWorkers + blobWorkers
s := &FileSaver{
fs: fs,
saveBlob: save,
saveFilePool: NewBufferPool(ctx, int(poolSize), chunker.MaxSize),
pol: pol,

View File

@ -30,7 +30,7 @@ func createTestFiles(t testing.TB, num int) (files []string, cleanup func()) {
return files, cleanup
}
func startFileSaver(ctx context.Context, t testing.TB, fs fs.FS) (*FileSaver, *tomb.Tomb) {
func startFileSaver(ctx context.Context, t testing.TB) (*FileSaver, *tomb.Tomb) {
var tmb tomb.Tomb
saveBlob := func(ctx context.Context, tpe restic.BlobType, buf *Buffer) FutureBlob {
@ -45,7 +45,7 @@ func startFileSaver(ctx context.Context, t testing.TB, fs fs.FS) (*FileSaver, *t
t.Fatal(err)
}
s := NewFileSaver(ctx, &tmb, fs, saveBlob, pol, workers, workers)
s := NewFileSaver(ctx, &tmb, saveBlob, pol, workers, workers)
s.NodeFromFileInfo = restic.NodeFromFileInfo
return s, &tmb
@ -62,7 +62,7 @@ func TestFileSaver(t *testing.T) {
completeFn := func(*restic.Node, ItemStats) {}
testFs := fs.Local{}
s, tmb := startFileSaver(ctx, t, testFs)
s, tmb := startFileSaver(ctx, t)
var results []FutureFile