mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2025-09-23 04:53:32 +08:00
refactor
This commit is contained in:
@@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/rand/v2"
|
"math/rand/v2"
|
||||||
"reflect"
|
|
||||||
"strings"
|
"strings"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
@@ -92,7 +91,8 @@ func (ms *MasterServer) ProcessGrowRequest() {
|
|||||||
// filter out identical requests being processed
|
// filter out identical requests being processed
|
||||||
found := false
|
found := false
|
||||||
filter.Range(func(k, v interface{}) bool {
|
filter.Range(func(k, v interface{}) bool {
|
||||||
if reflect.DeepEqual(k, req) {
|
existingReq := k.(*topology.VolumeGrowRequest)
|
||||||
|
if existingReq.Equals(req) {
|
||||||
found = true
|
found = true
|
||||||
}
|
}
|
||||||
return !found
|
return !found
|
||||||
|
@@ -5,6 +5,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
|
||||||
"math/rand/v2"
|
"math/rand/v2"
|
||||||
|
"reflect"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
@@ -29,6 +30,11 @@ type VolumeGrowRequest struct {
|
|||||||
Option *VolumeGrowOption
|
Option *VolumeGrowOption
|
||||||
Count uint32
|
Count uint32
|
||||||
Force bool
|
Force bool
|
||||||
|
Reason string
|
||||||
|
}
|
||||||
|
|
||||||
|
func (vg *VolumeGrowRequest) Equals(req *VolumeGrowRequest) bool {
|
||||||
|
return reflect.DeepEqual(existingReq.Option, req.Option) && vg.Count == req.Count
|
||||||
}
|
}
|
||||||
|
|
||||||
type volumeGrowthStrategy struct {
|
type volumeGrowthStrategy struct {
|
||||||
|
Reference in New Issue
Block a user