Browse Source

add comments

pull/991/head
Chris Lu 6 years ago
parent
commit
e913ee380a
  1. 2
      weed/topology/topology.go

2
weed/topology/topology.go

@ -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)

Loading…
Cancel
Save