You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
862 B

3 months ago
  1. package shell
  2. import (
  3. "context"
  4. "io"
  5. "github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
  6. )
  7. func init() {
  8. Commands = append(Commands, &commandEnableVacuum{})
  9. }
  10. type commandEnableVacuum struct {
  11. }
  12. func (c *commandEnableVacuum) Name() string {
  13. return "volume.vacuum.enable"
  14. }
  15. func (c *commandEnableVacuum) Help() string {
  16. return `enable vacuuming request from Master
  17. volume.vacuum.enable
  18. `
  19. }
  20. func (c *commandEnableVacuum) HasTag(CommandTag) bool {
  21. return false
  22. }
  23. func (c *commandEnableVacuum) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
  24. if err = commandEnv.confirmIsLocked(args); err != nil {
  25. return
  26. }
  27. err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {
  28. _, err = client.EnableVacuum(context.Background(), &master_pb.EnableVacuumRequest{})
  29. return err
  30. })
  31. return
  32. }