mirror of
https://github.com/restic/restic.git
synced 2025-12-15 18:32:25 +00:00
Basic rate limiting implementation.
Added `--limit-upload` and `--limit-download` flags to rate limit backups and restores.
This commit is contained in:
17
internal/limiter/limiter.go
Normal file
17
internal/limiter/limiter.go
Normal file
@@ -0,0 +1,17 @@
|
||||
package limiter
|
||||
|
||||
import (
|
||||
"io"
|
||||
)
|
||||
|
||||
// Limiter defines an interface that implementors can use to rate limit I/O
|
||||
// according to some policy defined and configured by the implementor.
|
||||
type Limiter interface {
|
||||
// Upstream returns a rate limited reader that is intended to be used in
|
||||
// uploads.
|
||||
Upstream(r io.Reader) io.Reader
|
||||
|
||||
// Downstream returns a rate limited reader that is intended to be used
|
||||
// for downloads.
|
||||
Downstream(r io.Reader) io.Reader
|
||||
}
|
||||
Reference in New Issue
Block a user