Files
kopia/cli/command_server_flush.go
Jarek Kowalski 8515d050e5 test(infra): improved support for in-process testing (#2169)
* feat(infra): improved support for in-process testing

* support for killing of a running server using simulated Ctrl-C
* support for overriding os.Stdin
* migrated many tests from the exe runner to in-process runner

* added required indirection when defining Envar() so we can later override it in tests

* refactored CLI runners by moving environment overrides to CLITestEnv
2022-07-09 18:22:50 -07:00

24 lines
620 B
Go

package cli
import (
"context"
"github.com/kopia/kopia/internal/apiclient"
"github.com/kopia/kopia/internal/serverapi"
)
type commandServerFlush struct {
sf serverClientFlags
}
func (c *commandServerFlush) setup(svc appServices, parent commandParent) {
cmd := parent.Command("flush", "Flush the state of Kopia server to persistent storage, etc.")
c.sf.setup(svc, cmd)
cmd.Action(svc.serverAction(&c.sf, c.run))
}
func (c *commandServerFlush) run(ctx context.Context, cli *apiclient.KopiaAPIClient) error {
// nolint:wrapcheck
return cli.Post(ctx, "control/flush", &serverapi.Empty{}, &serverapi.Empty{})
}