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
711 B

  1. package topology
  2. import (
  3. "code.google.com/p/weed-fs/go/glog"
  4. "code.google.com/p/weed-fs/go/storage"
  5. "github.com/goraft/raft"
  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(4).Infoln("max volume id", before, "==>", topo.GetMaxVolumeId())
  23. return nil, nil
  24. }