cluster_commands.go 728 B

12345678910111213141516171819202122232425262728293031
  1. package topology
  2. import (
  3. "github.com/chrislusf/raft"
  4. "github.com/chrislusf/seaweedfs/weed/glog"
  5. "github.com/chrislusf/seaweedfs/weed/storage"
  6. )
  7. type MaxVolumeIdCommand struct {
  8. MaxVolumeId storage.VolumeId `json:"maxVolumeId"`
  9. }
  10. func NewMaxVolumeIdCommand(value storage.VolumeId) *MaxVolumeIdCommand {
  11. return &MaxVolumeIdCommand{
  12. MaxVolumeId: value,
  13. }
  14. }
  15. func (c *MaxVolumeIdCommand) CommandName() string {
  16. return "MaxVolumeId"
  17. }
  18. func (c *MaxVolumeIdCommand) Apply(server raft.Server) (interface{}, error) {
  19. topo := server.Context().(*Topology)
  20. before := topo.GetMaxVolumeId()
  21. topo.UpAdjustMaxVolumeId(c.MaxVolumeId)
  22. glog.V(0).Infoln("max volume id", before, "==>", topo.GetMaxVolumeId())
  23. return nil, nil
  24. }