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

@@ -473,13 +473,19 @@ func (vl *VolumeLayout) SetVolumeCrowded(vid needle.VolumeId) {
}
}
func (vl *VolumeLayout) ToMap() map[string]interface{} {
m := make(map[string]interface{})
m["replication"] = vl.rp.String()
m["ttl"] = vl.ttl.String()
m["writables"] = vl.writables
type VolumeLayoutInfo struct {
Replication string `json:"replication"`
TTL string `json:"ttl"`
Writables []needle.VolumeId `json:"writables"`
Collection string `json:"collection"`
}
func (vl *VolumeLayout) ToInfo() (info VolumeLayoutInfo) {
info.Replication = vl.rp.String()
info.TTL = vl.ttl.String()
info.Writables = vl.writables
//m["locations"] = vl.vid2location
return m
return
}
func (vl *VolumeLayout) Stats() *VolumeLayoutStats {