command_volume_vacuum_disable.go 909 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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, &commandDisableVacuum{})
  9. }
  10. type commandDisableVacuum struct {
  11. }
  12. func (c *commandDisableVacuum) Name() string {
  13. return "volume.vacuum.disable"
  14. }
  15. func (c *commandDisableVacuum) Help() string {
  16. return `disable vacuuming request from Master, however volume.vacuum still works.
  17. volume.vacuum.disable
  18. `
  19. }
  20. func (c *commandDisableVacuum) HasTag(CommandTag) bool {
  21. return false
  22. }
  23. func (c *commandDisableVacuum) 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.DisableVacuum(context.Background(), &master_pb.DisableVacuumRequest{})
  29. return err
  30. })
  31. return
  32. }