diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2022-07-22 02:43:07 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-07-22 02:43:07 -0700 |
| commit | 8d97add89cddb316466776d875e9dc1419932ae6 (patch) | |
| tree | ff08269bbead68cb88f3e98f854cbefa165e4edf /weed/topology/data_node.go | |
| parent | 7a6c559ab4a6b696bb574454b297ebefabec29ed (diff) | |
| parent | 58f2dd674061bb48f433abbebd604ba7a8fe1aa7 (diff) | |
| download | seaweedfs-8d97add89cddb316466776d875e9dc1419932ae6.tar.xz seaweedfs-8d97add89cddb316466776d875e9dc1419932ae6.zip | |
Merge pull request #3348 from ningfdx/remote
optimiz: master ui will render data in order
Diffstat (limited to 'weed/topology/data_node.go')
| -rw-r--r-- | weed/topology/data_node.go | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/weed/topology/data_node.go b/weed/topology/data_node.go index 6bdbd965f..33bff2d59 100644 --- a/weed/topology/data_node.go +++ b/weed/topology/data_node.go @@ -217,10 +217,18 @@ 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 DataNodeInfo 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) ToInfo() (info DataNodeInfo) { + info.Url = dn.Url() + info.PublicUrl = dn.PublicUrl // aggregated volume info var volumeCount, ecShardCount, maxVolumeCount int64 @@ -236,12 +244,12 @@ func (dn *DataNode) ToMap() interface{} { volumeIds += " " + d.GetVolumeIds() } - ret["Volumes"] = volumeCount - ret["EcShards"] = ecShardCount - ret["Max"] = maxVolumeCount - ret["VolumeIds"] = volumeIds + info.Volumes = volumeCount + info.EcShards = ecShardCount + info.Max = maxVolumeCount + info.VolumeIds = volumeIds - return ret + return } func (dn *DataNode) ToDataNodeInfo() *master_pb.DataNodeInfo { |
