weed shell: list volumes

This commit is contained in:
Chris Lu
2019-03-17 20:27:08 -07:00
parent 22fbbf023b
commit aca653c08b
13 changed files with 643 additions and 127 deletions

View File

@@ -1,5 +1,7 @@
package topology
import "github.com/chrislusf/seaweedfs/weed/pb/master_pb"
type DataCenter struct {
NodeImpl
}
@@ -38,3 +40,18 @@ func (dc *DataCenter) ToMap() interface{} {
m["Racks"] = racks
return m
}
func (dc *DataCenter) ToDataCenterInfo() *master_pb.DataCenterInfo {
m := &master_pb.DataCenterInfo{
Id: string(dc.Id()),
VolumeCount: uint64(dc.GetVolumeCount()),
MaxVolumeCount: uint64(dc.GetMaxVolumeCount()),
FreeVolumeCount: uint64(dc.FreeSpace()),
ActiveVolumeCount: uint64(dc.GetActiveVolumeCount()),
}
for _, c := range dc.Children() {
rack := c.(*Rack)
m.RackInfos = append(m.RackInfos, rack.ToRackInfo())
}
return m
}