rename variables

This commit is contained in:
chrislu 2022-09-11 19:18:42 -07:00
parent 4af8c427eb
commit 6690236754
2 changed files with 8 additions and 8 deletions

View file

@ -54,14 +54,14 @@ func (dn *DataNode) getOrCreateDisk(diskType string) *Disk {
return disk return disk
} }
func (dn *DataNode) doAddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChangedRO bool) { func (dn *DataNode) doAddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChanged bool) {
disk := dn.getOrCreateDisk(v.DiskType) disk := dn.getOrCreateDisk(v.DiskType)
return disk.AddOrUpdateVolume(v) return disk.AddOrUpdateVolume(v)
} }
// UpdateVolumes detects new/deleted/changed volumes on a volume server // UpdateVolumes detects new/deleted/changed volumes on a volume server
// used in master to notify master clients of these changes. // used in master to notify master clients of these changes.
func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolumes, deletedVolumes, changeRO []storage.VolumeInfo) { func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolumes, deletedVolumes, changedVolumes []storage.VolumeInfo) {
actualVolumeMap := make(map[needle.VolumeId]storage.VolumeInfo) actualVolumeMap := make(map[needle.VolumeId]storage.VolumeInfo)
for _, v := range actualVolumes { for _, v := range actualVolumes {
@ -94,12 +94,12 @@ func (dn *DataNode) UpdateVolumes(actualVolumes []storage.VolumeInfo) (newVolume
} }
} }
for _, v := range actualVolumes { for _, v := range actualVolumes {
isNew, isChangedRO := dn.doAddOrUpdateVolume(v) isNew, isChanged := dn.doAddOrUpdateVolume(v)
if isNew { if isNew {
newVolumes = append(newVolumes, v) newVolumes = append(newVolumes, v)
} }
if isChangedRO { if isChanged {
changeRO = append(changeRO, v) changedVolumes = append(changedVolumes, v)
} }
} }
return return

View file

@ -144,13 +144,13 @@ func (d *Disk) String() string {
return fmt.Sprintf("Disk:%s, volumes:%v, ecShards:%v", d.NodeImpl.String(), d.volumes, d.ecShards) return fmt.Sprintf("Disk:%s, volumes:%v, ecShards:%v", d.NodeImpl.String(), d.volumes, d.ecShards)
} }
func (d *Disk) AddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChangedRO bool) { func (d *Disk) AddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChanged bool) {
d.Lock() d.Lock()
defer d.Unlock() defer d.Unlock()
return d.doAddOrUpdateVolume(v) return d.doAddOrUpdateVolume(v)
} }
func (d *Disk) doAddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChangedRO bool) { func (d *Disk) doAddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChanged bool) {
deltaDiskUsages := newDiskUsages() deltaDiskUsages := newDiskUsages()
deltaDiskUsage := deltaDiskUsages.getOrCreateDisk(types.ToDiskType(v.DiskType)) deltaDiskUsage := deltaDiskUsages.getOrCreateDisk(types.ToDiskType(v.DiskType))
if oldV, ok := d.volumes[v.Id]; !ok { if oldV, ok := d.volumes[v.Id]; !ok {
@ -175,7 +175,7 @@ func (d *Disk) doAddOrUpdateVolume(v storage.VolumeInfo) (isNew, isChangedRO boo
} }
d.UpAdjustDiskUsageDelta(deltaDiskUsages) d.UpAdjustDiskUsageDelta(deltaDiskUsages)
} }
isChangedRO = d.volumes[v.Id].ReadOnly != v.ReadOnly isChanged = d.volumes[v.Id].ReadOnly != v.ReadOnly
d.volumes[v.Id] = v d.volumes[v.Id] = v
} }
return return