change topology mapping definition, improve spelling

This commit is contained in:
ningfd
2022-07-22 17:18:33 +08:00
parent 6f882eb354
commit 58f2dd6740
7 changed files with 61 additions and 59 deletions

View File

@@ -217,7 +217,7 @@ func (dn *DataNode) ServerAddress() pb.ServerAddress {
return pb.NewServerAddress(dn.Ip, dn.Port, dn.GrpcPort)
}
type DataNodeMap struct {
type DataNodeInfo struct {
Url string `json:"Url"`
PublicUrl string `json:"PublicUrl"`
Volumes int64 `json:"Volumes"`
@@ -226,10 +226,9 @@ type DataNodeMap struct {
VolumeIds string `json:"VolumeIds"`
}
func (dn *DataNode) ToMap() DataNodeMap {
ret := DataNodeMap{}
ret.Url = dn.Url()
ret.PublicUrl = dn.PublicUrl
func (dn *DataNode) ToInfo() (info DataNodeInfo) {
info.Url = dn.Url()
info.PublicUrl = dn.PublicUrl
// aggregated volume info
var volumeCount, ecShardCount, maxVolumeCount int64
@@ -245,12 +244,12 @@ func (dn *DataNode) ToMap() DataNodeMap {
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 {