SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
optimiz: master ui will render data in order
ningfd6f882eb354ff
diff --git a/weed/topology/data_center.go b/weed/topology/data_center.goindex 60d91ba6da..304a5ccae0 100644--- a/weed/topology/data_center.go+++ b/weed/topology/data_center.go@@ -2,6 +2,7 @@ package topologyimport ("github.com/chrislusf/seaweedfs/weed/pb/master_pb"+ "golang.org/x/exp/slices")type DataCenter struct {@@ -30,15 +31,24 @@ func (dc *DataCenter) GetOrCreateRack(rackName string) *Rack {return rack}-func (dc *DataCenter) ToMap() interface{} {- m := make(map[string]interface{})- m["Id"] = dc.Id()- var racks []interface{}+type DataCenterMap struct {+ Id NodeId `json:"Id"`+ Racks []RackMap `json:"Racks"`+}++func (dc *DataCenter) ToMap() DataCenterMap {+ m := DataCenterMap{}+ m.Id = dc.Id()+ var racks []RackMapfor _, c := range dc.Children() {rack := c.(*Rack)racks = append(racks, rack.ToMap())}- m["Racks"] = racks++ slices.SortFunc(racks, func(a, b RackMap) bool {+ return a.Id < b.Id+ })+ m.Racks = racksreturn m}diff --git a/weed/topology/data_node.go b/weed/topology/data_node.goindex 6bdbd965ff..6a24c4a49e 100644--- a/weed/topology/data_node.go+++ b/weed/topology/data_node.go@@ -217,10 +217,19 @@ func (dn *DataNode) ServerAddress() pb.ServerAddress {return pb.NewServerAddress(dn.Ip, dn.Port, dn.GrpcPort)}-func (dn *DataNode) ToMap() interface{} {- ret := make(map[string]interface{})- ret["Url"] = dn.Url()- ret["PublicUrl"] = dn.PublicUrl+type DataNodeMap struct {+ Url string `json:"Url"`+ PublicUrl string `json:"PublicUrl"`+ Volumes int64 `json:"Volumes"`+ EcShards int64 `json:"EcShards"`+ Max int64 `json:"Max"`+ VolumeIds string `json:"VolumeIds"`+}++func (dn *DataNode) ToMap() DataNodeMap {+ ret := DataNodeMap{}+ ret.Url = dn.Url()+ ret.PublicUrl = dn.PublicUrl// aggregated volume infovar volumeCount, ecShardCount, maxVolumeCount int64@@ -236,10 +245,10 @@ func (dn *DataNode) ToMap() interface{} {volumeIds += " " + d.GetVolumeIds()}- ret["Volumes"] = volumeCount- ret["EcShards"] = ecShardCount- ret["Max"] = maxVolumeCount- ret["VolumeIds"] = volumeIds+ ret.Volumes = volumeCount+ ret.EcShards = ecShardCount+ ret.Max = maxVolumeCount+ ret.VolumeIds = volumeIdsreturn ret}diff --git a/weed/topology/rack.go b/weed/topology/rack.goindex cd09746b2f..0588dfa7da 100644--- a/weed/topology/rack.go+++ b/weed/topology/rack.go@@ -4,6 +4,7 @@ import ("github.com/chrislusf/seaweedfs/weed/pb/master_pb""github.com/chrislusf/seaweedfs/weed/storage/types""github.com/chrislusf/seaweedfs/weed/util"+ "golang.org/x/exp/slices""time")@@ -53,15 +54,25 @@ func (r *Rack) GetOrCreateDataNode(ip string, port int, grpcPort int, publicUrlreturn dn}-func (r *Rack) ToMap() interface{} {- m := make(map[string]interface{})- m["Id"] = r.Id()- var dns []interface{}+type RackMap struct {+ Id NodeId `json:"Id"`+ DataNodes []DataNodeMap `json:"DataNodes"`+}++func (r *Rack) ToMap() RackMap {+ m := RackMap{}+ m.Id = r.Id()+ var dns []DataNodeMapfor _, c := range r.Children() {dn := c.(*DataNode)dns = append(dns, dn.ToMap())}- m["DataNodes"] = dns++ slices.SortFunc(dns, func(a, b DataNodeMap) bool {+ return a.Url < b.Url+ })++ m.DataNodes = dnsreturn m}diff --git a/weed/topology/topology_map.go b/weed/topology/topology_map.goindex 0fedb62212..b6585e9649 100644--- a/weed/topology/topology_map.go+++ b/weed/topology/topology_map.go@@ -1,17 +1,32 @@package topology-import "github.com/chrislusf/seaweedfs/weed/pb/master_pb"+import (+ "github.com/chrislusf/seaweedfs/weed/pb/master_pb"+ "golang.org/x/exp/slices"+)++type TopologyMap struct {+ Max int64 `json:"Max"`+ Free int64 `json:"Free"`+ DataCenters []DataCenterMap `json:"DataCenters"`+ Layouts []interface{} `json:"Layouts"`+}func (t *Topology) ToMap() interface{} {- m := make(map[string]interface{})- m["Max"] = t.diskUsages.GetMaxVolumeCount()- m["Free"] = t.diskUsages.FreeSpace()- var dcs []interface{}+ m := TopologyMap{}+ m.Max = t.diskUsages.GetMaxVolumeCount()+ m.Free = t.diskUsages.FreeSpace()+ var dcs []DataCenterMapfor _, c := range t.Children() {dc := c.(*DataCenter)dcs = append(dcs, dc.ToMap())}- m["DataCenters"] = dcs++ slices.SortFunc(dcs, func(a, b DataCenterMap) bool {+ return a.Id < b.Id+ })++ m.DataCenters = dcsvar layouts []interface{}for _, col := range t.collectionMap.Items() {c := col.(*Collection)@@ -23,7 +38,7 @@ func (t *Topology) ToMap() interface{} {}}}- m["Layouts"] = layouts+ m.Layouts = layoutsreturn m}