[master] refactor func ShouldGrowVolumes (#5884)
This commit is contained in:
committed by
GitHub
parent
eb02946c97
commit
67a252ee8a
@@ -329,7 +329,7 @@ func (t *Topology) UnRegisterVolumeLayout(v storage.VolumeInfo, dn *DataNode) {
|
||||
}
|
||||
|
||||
func (t *Topology) DataCenterExists(dcName string) bool {
|
||||
return dcName == "" || t.GetOrCreateDataCenter(dcName) != nil
|
||||
return dcName == "" || t.GetDataCenter(dcName) != nil
|
||||
}
|
||||
|
||||
func (t *Topology) GetDataCenter(dcName string) (dc *DataCenter) {
|
||||
@@ -358,6 +358,15 @@ func (t *Topology) GetOrCreateDataCenter(dcName string) *DataCenter {
|
||||
return dc
|
||||
}
|
||||
|
||||
func (t *Topology) ListDataCenters() (dcs []string) {
|
||||
t.RLock()
|
||||
defer t.RUnlock()
|
||||
for _, c := range t.children {
|
||||
dcs = append(dcs, string(c.(*DataCenter).Id()))
|
||||
}
|
||||
return dcs
|
||||
}
|
||||
|
||||
func (t *Topology) SyncDataNodeRegistration(volumes []*master_pb.VolumeInformationMessage, dn *DataNode) (newVolumes, deletedVolumes []storage.VolumeInfo) {
|
||||
// convert into in memory struct storage.VolumeInfo
|
||||
var volumeInfos []storage.VolumeInfo
|
||||
|
||||
Reference in New Issue
Block a user