mirror of
https://github.com/kopia/kopia.git
synced 2026-01-23 22:07:54 -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
```
34 lines
790 B
Go
34 lines
790 B
Go
package cli
|
|
|
|
import (
|
|
"context"
|
|
|
|
"github.com/pkg/errors"
|
|
|
|
"github.com/kopia/kopia/internal/apiclient"
|
|
"github.com/kopia/kopia/repo/blob/throttling"
|
|
)
|
|
|
|
type commandServerThrottleGet struct {
|
|
sf serverClientFlags
|
|
|
|
ctg commonThrottleGet
|
|
}
|
|
|
|
func (c *commandServerThrottleGet) setup(svc appServices, parent commandParent) {
|
|
cmd := parent.Command("get", "Get throttling parameters for a running server")
|
|
c.sf.setup(cmd)
|
|
c.ctg.setup(svc, cmd)
|
|
cmd.Action(svc.serverAction(&c.sf, c.run))
|
|
}
|
|
|
|
func (c *commandServerThrottleGet) run(ctx context.Context, cli *apiclient.KopiaAPIClient) error {
|
|
var limits throttling.Limits
|
|
|
|
if err := cli.Get(ctx, "control/throttle", nil, &limits); err != nil {
|
|
return errors.Wrap(err, "unable to get current throttle")
|
|
}
|
|
|
|
return c.ctg.output(&limits)
|
|
}
|