mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-18 15:17:54 +08:00
support enable/disable vacuum (#4087)
* stop vacuum * suspend/resume vacuum * remove unused code * rename * rename param
This commit is contained in:
41
weed/shell/command_volume_vacuum_disable.go
Normal file
41
weed/shell/command_volume_vacuum_disable.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Commands = append(Commands, &commandDisableVacuum{})
|
||||
}
|
||||
|
||||
type commandDisableVacuum struct {
|
||||
}
|
||||
|
||||
func (c *commandDisableVacuum) Name() string {
|
||||
return "volume.vacuum.disable"
|
||||
}
|
||||
|
||||
func (c *commandDisableVacuum) Help() string {
|
||||
return `disable vacuuming
|
||||
|
||||
volume.vacuum.disable
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
func (c *commandDisableVacuum) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
||||
|
||||
if err = commandEnv.confirmIsLocked(args); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {
|
||||
_, err = client.DisableVacuum(context.Background(), &master_pb.DisableVacuumRequest{})
|
||||
return err
|
||||
})
|
||||
|
||||
return
|
||||
}
|
41
weed/shell/command_volume_vacuum_enable.go
Normal file
41
weed/shell/command_volume_vacuum_enable.go
Normal file
@@ -0,0 +1,41 @@
|
||||
package shell
|
||||
|
||||
import (
|
||||
"context"
|
||||
"io"
|
||||
|
||||
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
||||
)
|
||||
|
||||
func init() {
|
||||
Commands = append(Commands, &commandEnableVacuum{})
|
||||
}
|
||||
|
||||
type commandEnableVacuum struct {
|
||||
}
|
||||
|
||||
func (c *commandEnableVacuum) Name() string {
|
||||
return "volume.vacuum.enable"
|
||||
}
|
||||
|
||||
func (c *commandEnableVacuum) Help() string {
|
||||
return `enable vacuuming
|
||||
|
||||
volume.vacuum.enable
|
||||
|
||||
`
|
||||
}
|
||||
|
||||
func (c *commandEnableVacuum) Do(args []string, commandEnv *CommandEnv, writer io.Writer) (err error) {
|
||||
|
||||
if err = commandEnv.confirmIsLocked(args); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
err = commandEnv.MasterClient.WithClient(false, func(client master_pb.SeaweedClient) error {
|
||||
_, err = client.EnableVacuum(context.Background(), &master_pb.EnableVacuumRequest{})
|
||||
return err
|
||||
})
|
||||
|
||||
return
|
||||
}
|
Reference in New Issue
Block a user