Files
kopia/cli/command_repository_throttle_get.go
Jarek Kowalski 99eeb3c063 feat(cli): added CLI for controlling throttler (#1956)
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
```
2022-05-18 01:27:06 -07:00

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
}