@ -87,7 +87,7 @@ func (ecInfo *EcVolumeInfo) Minus(other *EcVolumeInfo) *EcVolumeInfo {
// Copy shard sizes for remaining shards
// Copy shard sizes for remaining shards
retIndex := 0
retIndex := 0
for shardId := ShardId ( 0 ) ; shardId < MaxShardCount && retIndex < len ( ret . ShardSizes ) ; shardId ++ {
for shardId := ShardId ( 0 ) ; shardId < ShardId ( MaxShardCount ) && retIndex < len ( ret . ShardSizes ) ; shardId ++ {
if ret . ShardBits . HasShardId ( shardId ) {
if ret . ShardBits . HasShardId ( shardId ) {
if size , exists := ecInfo . GetShardSize ( shardId ) ; exists {
if size , exists := ecInfo . GetShardSize ( shardId ) ; exists {
ret . ShardSizes [ retIndex ] = size
ret . ShardSizes [ retIndex ] = size
@ -140,7 +140,7 @@ func (b ShardBits) HasShardId(id ShardId) bool {
}
}
func ( b ShardBits ) ShardIds ( ) ( ret [ ] ShardId ) {
func ( b ShardBits ) ShardIds ( ) ( ret [ ] ShardId ) {
for i := ShardId ( 0 ) ; i < MaxShardCount ; i ++ {
for i := ShardId ( 0 ) ; i < ShardId ( MaxShardCount ) ; i ++ {
if b . HasShardId ( i ) {
if b . HasShardId ( i ) {
ret = append ( ret , i )
ret = append ( ret , i )
}
}
@ -149,7 +149,7 @@ func (b ShardBits) ShardIds() (ret []ShardId) {
}
}
func ( b ShardBits ) ToUint32Slice ( ) ( ret [ ] uint32 ) {
func ( b ShardBits ) ToUint32Slice ( ) ( ret [ ] uint32 ) {
for i := uint32 ( 0 ) ; i < MaxShardCount ; i ++ {
for i := uint32 ( 0 ) ; i < uint32 ( MaxShardCount ) ; i ++ {
if b . HasShardId ( ShardId ( i ) ) {
if b . HasShardId ( ShardId ( i ) ) {
ret = append ( ret , i )
ret = append ( ret , i )
}
}
@ -216,7 +216,7 @@ func (b ShardBits) IndexToShardId(index int) (shardId ShardId, found bool) {
}
}
currentIndex := 0
currentIndex := 0
for i := ShardId ( 0 ) ; i < MaxShardCount ; i ++ {
for i := ShardId ( 0 ) ; i < ShardId ( MaxShardCount ) ; i ++ {
if b . HasShardId ( i ) {
if b . HasShardId ( i ) {
if currentIndex == index {
if currentIndex == index {
return i , true
return i , true
@ -245,7 +245,7 @@ func (ecInfo *EcVolumeInfo) resizeShardSizes(prevShardBits ShardBits) {
// Copy existing sizes to new positions based on current ShardBits
// Copy existing sizes to new positions based on current ShardBits
if len ( ecInfo . ShardSizes ) > 0 {
if len ( ecInfo . ShardSizes ) > 0 {
newIndex := 0
newIndex := 0
for shardId := ShardId ( 0 ) ; shardId < MaxShardCount && newIndex < expectedLength ; shardId ++ {
for shardId := ShardId ( 0 ) ; shardId < ShardId ( MaxShardCount ) && newIndex < expectedLength ; shardId ++ {
if ecInfo . ShardBits . HasShardId ( shardId ) {
if ecInfo . ShardBits . HasShardId ( shardId ) {
// Try to find the size for this shard in the old array using previous ShardBits
// Try to find the size for this shard in the old array using previous ShardBits
if oldIndex , found := prevShardBits . ShardIdToIndex ( shardId ) ; found && oldIndex < len ( ecInfo . ShardSizes ) {
if oldIndex , found := prevShardBits . ShardIdToIndex ( shardId ) ; found && oldIndex < len ( ecInfo . ShardSizes ) {