add comments

This commit is contained in:
Chris Lu 2019-05-23 00:04:24 -07:00
parent 7180520889
commit e913ee380a

View file

@ -166,6 +166,7 @@ func (t *Topology) GetOrCreateDataCenter(dcName string) *DataCenter {
} }
func (t *Topology) SyncDataNodeRegistration(volumes []*master_pb.VolumeInformationMessage, dn *DataNode) (newVolumes, deletedVolumes []storage.VolumeInfo) { 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 var volumeInfos []storage.VolumeInfo
for _, v := range volumes { for _, v := range volumes {
if vi, err := storage.NewVolumeInfo(v); err == nil { if vi, err := storage.NewVolumeInfo(v); err == nil {
@ -174,6 +175,7 @@ func (t *Topology) SyncDataNodeRegistration(volumes []*master_pb.VolumeInformati
glog.V(0).Infof("Fail to convert joined volume information: %v", err) glog.V(0).Infof("Fail to convert joined volume information: %v", err)
} }
} }
// find out the delta volumes
newVolumes, deletedVolumes = dn.UpdateVolumes(volumeInfos) newVolumes, deletedVolumes = dn.UpdateVolumes(volumeInfos)
for _, v := range newVolumes { for _, v := range newVolumes {
t.RegisterVolumeLayout(v, dn) t.RegisterVolumeLayout(v, dn)