Fix typo (dist => dest)

This commit is contained in:
Amir H. Yeganemehr 2023-11-13 18:06:58 +03:30 committed by Chris Lu
parent bb274ea8a3
commit d3556479be

View File

@ -244,8 +244,8 @@ func (c *commandFsMergeVolumes) createMergePlan(collection string, toVolumeId ne
func (c *commandFsMergeVolumes) getVolumeSizeBasedOnPlan(plan map[needle.VolumeId]needle.VolumeId, vid needle.VolumeId) uint64 { func (c *commandFsMergeVolumes) getVolumeSizeBasedOnPlan(plan map[needle.VolumeId]needle.VolumeId, vid needle.VolumeId) uint64 {
size := c.getVolumeSizeById(vid) size := c.getVolumeSizeById(vid)
for src, dist := range plan { for src, dest := range plan {
if dist == vid { if dest == vid {
size += c.getVolumeSizeById(src) size += c.getVolumeSizeById(src)
} }
} }
@ -263,18 +263,18 @@ func (c *commandFsMergeVolumes) getVolumeSizeById(vid needle.VolumeId) uint64 {
func (c *commandFsMergeVolumes) printPlan(plan map[needle.VolumeId]needle.VolumeId) { func (c *commandFsMergeVolumes) printPlan(plan map[needle.VolumeId]needle.VolumeId) {
fmt.Printf("max volume size: %d MB\n", c.volumeSizeLimit/1024/1024) fmt.Printf("max volume size: %d MB\n", c.volumeSizeLimit/1024/1024)
reversePlan := make(map[needle.VolumeId][]needle.VolumeId) reversePlan := make(map[needle.VolumeId][]needle.VolumeId)
for src, dist := range plan { for src, dest := range plan {
reversePlan[dist] = append(reversePlan[dist], src) reversePlan[dest] = append(reversePlan[dest], src)
} }
for dist, srcs := range reversePlan { for dest, srcs := range reversePlan {
currentSize := c.getVolumeSizeById(dist) currentSize := c.getVolumeSizeById(dest)
for _, src := range srcs { for _, src := range srcs {
srcSize := c.getVolumeSizeById(src) srcSize := c.getVolumeSizeById(src)
newSize := currentSize + srcSize newSize := currentSize + srcSize
fmt.Printf( fmt.Printf(
"volume %d (%d MB) merge into volume %d (%d MB => %d MB)\n", "volume %d (%d MB) merge into volume %d (%d MB => %d MB)\n",
src, srcSize/1024/1024, src, srcSize/1024/1024,
dist, currentSize/1024/1024, newSize/1024/1024, dest, currentSize/1024/1024, newSize/1024/1024,
) )
currentSize = newSize currentSize = newSize