mirror of
https://github.com/kopia/kopia.git
synced 2026-01-24 14:28:06 -05:00
Supported are:
```
$ kopia throttle set \
--download-bytes-per-second=N | unlimited
--upload-bytes-per-second=N | unlimited
--read-requests-per-second=N | unlimited
--write-requests-per-second=N | unlimited
--list-requests-per-second=N | unlimited
--concurrent-reads=N | unlimited
--concurrent-writes=N | unlimited
```
To change parameters of a running server use:
```
$ kopia server throttle set \
--address=<server-url> \
--server-control-password=<password> \
--download-bytes-per-second=N | unlimited
--upload-bytes-per-second=N | unlimited
--read-requests-per-second=N | unlimited
--write-requests-per-second=N | unlimited
--list-requests-per-second=N | unlimited
--concurrent-reads=N | unlimited
--concurrent-writes=N | unlimited
```
29 lines
591 B
Go
29 lines
591 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/kopia/kopia/repo"
|
|
)
|
|
|
|
type commandRepositoryThrottleGet struct {
|
|
ctg commonThrottleGet
|
|
}
|
|
|
|
func (c *commandRepositoryThrottleGet) setup(svc appServices, parent commandParent) {
|
|
cmd := parent.Command("get", "Get throttling parameters for a repository")
|
|
c.ctg.setup(svc, cmd)
|
|
|
|
cmd.Action(svc.directRepositoryReadAction(c.run))
|
|
}
|
|
|
|
func (c *commandRepositoryThrottleGet) run(ctx context.Context, rep repo.DirectRepository) error {
|
|
limits := rep.Throttler().Limits()
|
|
|
|
if err := c.ctg.output(&limits); err != nil {
|
|
return err
|
|
}
|
|
|
|
return nil
|
|
}
|