|
|
@ -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 |
|
|
|
} |
|
|
|