cmd/restic, limiter: Move config knowledge to internal packages

The GlobalOptions struct now embeds a backend.TransportOptions, so it
doesn't need to construct one in open and create. The upload and
download limits are similarly now a struct in internal/limiter that is
embedded in GlobalOptions.
This commit is contained in:
greatroar committed 2022-06-22 18:29:58 +02:00
1 parent 1dd4b9b60e
commit 90d2c0502b
4 files changed
+29 -38

No files matched your search

+2 -2
View File
@@ -36,7 +36,7 @@ func TestLimitBackendSave(t *testing.T) {
}
return nil
}
limiter := NewStaticLimiter(42*1024, 42*1024)
limiter := NewStaticLimiter(Limits{42 * 1024, 42 * 1024})
limbe := LimitBackend(be, limiter)
rd := restic.NewByteReader(data, nil)
@@ -82,7 +82,7 @@ func TestLimitBackendLoad(t *testing.T) {
}
return newTracedReadCloser(src), nil
}
limiter := NewStaticLimiter(42*1024, 42*1024)
limiter := NewStaticLimiter(Limits{42 * 1024, 42 * 1024})
limbe := LimitBackend(be, limiter)
err := limbe.Load(context.TODO(), testHandle, 0, 0, func(rd io.Reader) error {