local/sftp: move limiter setup into backend

This commit is contained in:
Michael Eischer
2023-06-08 13:06:25 +02:00
parent 7d12c29286
commit 9aa9e0d1ec
4 changed files with 17 additions and 15 deletions

View File

@@ -44,11 +44,7 @@ type SFTP struct {
var _ restic.Backend = &SFTP{}
func NewFactory() location.Factory {
return location.NewLimitedBackendFactory(ParseConfig, location.NoPassword, func(ctx context.Context, cfg Config, _ limiter.Limiter) (*SFTP, error) {
return Create(ctx, cfg)
}, func(ctx context.Context, cfg Config, _ limiter.Limiter) (*SFTP, error) {
return Open(ctx, cfg)
})
return location.NewLimitedBackendFactory(ParseConfig, location.NoPassword, limiter.WrapBackendConstructor(Create), limiter.WrapBackendConstructor(Open))
}
const defaultLayout = "default"