mirror of
https://github.com/octoleo/restic.git
synced 2024-12-27 20:45:19 +00:00
Remove unused fs.FS from archiver.FileSaver
This commit is contained in:
parent
f2bf06a419
commit
2f8aa2ce30
@ -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.blobSaver = NewBlobSaver(ctx, t, arch.Repo, arch.Options.SaveBlobConcurrency)
|
||||||
|
|
||||||
arch.fileSaver = NewFileSaver(ctx, t,
|
arch.fileSaver = NewFileSaver(ctx, t,
|
||||||
arch.FS,
|
|
||||||
arch.blobSaver.Save,
|
arch.blobSaver.Save,
|
||||||
arch.Repo.Config().ChunkerPolynomial,
|
arch.Repo.Config().ChunkerPolynomial,
|
||||||
arch.Options.FileReadConcurrency, arch.Options.SaveBlobConcurrency)
|
arch.Options.FileReadConcurrency, arch.Options.SaveBlobConcurrency)
|
||||||
|
@ -53,7 +53,6 @@ type SaveBlobFn func(context.Context, restic.BlobType, *Buffer) FutureBlob
|
|||||||
|
|
||||||
// FileSaver concurrently saves incoming files to the repo.
|
// FileSaver concurrently saves incoming files to the repo.
|
||||||
type FileSaver struct {
|
type FileSaver struct {
|
||||||
fs fs.FS
|
|
||||||
saveFilePool *BufferPool
|
saveFilePool *BufferPool
|
||||||
saveBlob SaveBlobFn
|
saveBlob SaveBlobFn
|
||||||
|
|
||||||
@ -69,7 +68,7 @@ type FileSaver struct {
|
|||||||
|
|
||||||
// NewFileSaver returns a new file saver. A worker pool with fileWorkers is
|
// NewFileSaver returns a new file saver. A worker pool with fileWorkers is
|
||||||
// started, it is stopped when ctx is cancelled.
|
// 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)
|
ch := make(chan saveFileJob)
|
||||||
|
|
||||||
debug.Log("new file saver with %v file workers and %v blob workers", fileWorkers, blobWorkers)
|
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
|
poolSize := fileWorkers + blobWorkers
|
||||||
|
|
||||||
s := &FileSaver{
|
s := &FileSaver{
|
||||||
fs: fs,
|
|
||||||
saveBlob: save,
|
saveBlob: save,
|
||||||
saveFilePool: NewBufferPool(ctx, int(poolSize), chunker.MaxSize),
|
saveFilePool: NewBufferPool(ctx, int(poolSize), chunker.MaxSize),
|
||||||
pol: pol,
|
pol: pol,
|
||||||
|
@ -30,7 +30,7 @@ func createTestFiles(t testing.TB, num int) (files []string, cleanup func()) {
|
|||||||
return files, cleanup
|
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
|
var tmb tomb.Tomb
|
||||||
|
|
||||||
saveBlob := func(ctx context.Context, tpe restic.BlobType, buf *Buffer) FutureBlob {
|
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)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
s := NewFileSaver(ctx, &tmb, fs, saveBlob, pol, workers, workers)
|
s := NewFileSaver(ctx, &tmb, saveBlob, pol, workers, workers)
|
||||||
s.NodeFromFileInfo = restic.NodeFromFileInfo
|
s.NodeFromFileInfo = restic.NodeFromFileInfo
|
||||||
|
|
||||||
return s, &tmb
|
return s, &tmb
|
||||||
@ -62,7 +62,7 @@ func TestFileSaver(t *testing.T) {
|
|||||||
completeFn := func(*restic.Node, ItemStats) {}
|
completeFn := func(*restic.Node, ItemStats) {}
|
||||||
|
|
||||||
testFs := fs.Local{}
|
testFs := fs.Local{}
|
||||||
s, tmb := startFileSaver(ctx, t, testFs)
|
s, tmb := startFileSaver(ctx, t)
|
||||||
|
|
||||||
var results []FutureFile
|
var results []FutureFile
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user