cluster_commands.go 733 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/needle"
  6. )
  7. type MaxVolumeIdCommand struct {
  8. MaxVolumeId needle.VolumeId `json:"maxVolumeId"`
  9. }
  10. func NewMaxVolumeIdCommand(value needle.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(1).Infoln("max volume id", before, "==>", topo.GetMaxVolumeId())
  23. return nil, nil
  24. }