diff options
| author | ningfd <fangdi.ning@seetatech.com> | 2022-07-22 14:34:17 +0800 |
|---|---|---|
| committer | ningfd <fangdi.ning@seetatech.com> | 2022-07-22 14:37:49 +0800 |
| commit | 6f882eb354ff61d663a122c430781493cecf2467 (patch) | |
| tree | 07c1a9f1a2cff04952a799fa34790eae1c14d86d /weed/topology/data_node.go | |
| parent | 7a6c559ab4a6b696bb574454b297ebefabec29ed (diff) | |
| download | seaweedfs-6f882eb354ff61d663a122c430781493cecf2467.tar.xz seaweedfs-6f882eb354ff61d663a122c430781493cecf2467.zip | |
optimiz: master ui will render data in order
Diffstat (limited to 'weed/topology/data_node.go')
| -rw-r--r-- | weed/topology/data_node.go | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go index 6bdbd965f..6a24c4a49 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 info var 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 = volumeIds return ret } |
