aboutsummaryrefslogtreecommitdiff
path: root/weed/topology
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2023-09-25 09:35:16 -0700
committerchrislu <chris.lu@gmail.com>2023-09-25 09:35:16 -0700
commit645ae8c57bc449cbb298e90d1ad19f7d2153aea0 (patch)
tree08458e352ea27e8e673a3670269ec84f04512d77 /weed/topology
parent3d07895518b2b6e816518be0a2355c1f0a98ff15 (diff)
downloadseaweedfs-645ae8c57bc449cbb298e90d1ad19f7d2153aea0.tar.xz
seaweedfs-645ae8c57bc449cbb298e90d1ad19f7d2153aea0.zip
Revert "Revert "Merge branch 'master' of https://github.com/seaweedfs/seaweedfs""
This reverts commit 8cb42c39
Diffstat (limited to 'weed/topology')
-rw-r--r--weed/topology/data_center.go5
-rw-r--r--weed/topology/rack.go5
-rw-r--r--weed/topology/topology_info.go5
3 files changed, 9 insertions, 6 deletions
diff --git a/weed/topology/data_center.go b/weed/topology/data_center.go
index 26d2de7d3..55b17e911 100644
--- a/weed/topology/data_center.go
+++ b/weed/topology/data_center.go
@@ -3,6 +3,7 @@ package topology
import (
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
"golang.org/x/exp/slices"
+ "strings"
)
type DataCenter struct {
@@ -46,8 +47,8 @@ func (dc *DataCenter) ToInfo() (info DataCenterInfo) {
racks = append(racks, rack.ToInfo())
}
- slices.SortFunc(racks, func(a, b RackInfo) bool {
- return a.Id < b.Id
+ slices.SortFunc(racks, func(a, b RackInfo) int {
+ return strings.Compare(string(a.Id), string(b.Id))
})
info.Racks = racks
return
diff --git a/weed/topology/rack.go b/weed/topology/rack.go
index c96bf421e..6bf8b5b4e 100644
--- a/weed/topology/rack.go
+++ b/weed/topology/rack.go
@@ -5,6 +5,7 @@ import (
"github.com/seaweedfs/seaweedfs/weed/storage/types"
"github.com/seaweedfs/seaweedfs/weed/util"
"golang.org/x/exp/slices"
+ "strings"
"time"
)
@@ -69,8 +70,8 @@ func (r *Rack) ToInfo() (info RackInfo) {
dns = append(dns, dn.ToInfo())
}
- slices.SortFunc(dns, func(a, b DataNodeInfo) bool {
- return a.Url < b.Url
+ slices.SortFunc(dns, func(a, b DataNodeInfo) int {
+ return strings.Compare(a.Url, b.Url)
})
info.DataNodes = dns
diff --git a/weed/topology/topology_info.go b/weed/topology/topology_info.go
index 680a0528c..afbeb4894 100644
--- a/weed/topology/topology_info.go
+++ b/weed/topology/topology_info.go
@@ -3,6 +3,7 @@ package topology
import (
"github.com/seaweedfs/seaweedfs/weed/pb/master_pb"
"golang.org/x/exp/slices"
+ "strings"
)
type TopologyInfo struct {
@@ -21,8 +22,8 @@ func (t *Topology) ToInfo() (info TopologyInfo) {
dcs = append(dcs, dc.ToInfo())
}
- slices.SortFunc(dcs, func(a, b DataCenterInfo) bool {
- return a.Id < b.Id
+ slices.SortFunc(dcs, func(a, b DataCenterInfo) int {
+ return strings.Compare(string(a.Id), string(b.Id))
})
info.DataCenters = dcs