aboutsummaryrefslogtreecommitdiff
path: root/weed/topology/data_node.go
diff options
context:
space:
mode:
Diffstat (limited to 'weed/topology/data_node.go')
-rw-r--r--weed/topology/data_node.go25
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
}