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.

31 lines
728 B

  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. }