func()

in vhdcore/diskstream/diskstream.go [185:212]


func (s *DiskStream) EnumerateExtents(f func(*StreamExtent, error) bool) {
	blocksCount := s.vhdBlockFactory.GetBlockCount()
	i := int64(0)
	for ; i < blocksCount; i++ {
		if currentBlock, err := s.vhdBlockFactory.Create(uint32(i)); err != nil {
			continueEnumerate := f(nil, err)
			if !continueEnumerate {
				break
			}
		} else {
			if !currentBlock.IsEmpty {
				continueEnumerate := f(&StreamExtent{
					Range:            currentBlock.LogicalRange,
					OwnerVhdUniqueID: currentBlock.VhdUniqueID,
				}, nil)
				if !continueEnumerate {
					break
				}
			}
		}
	}
	if i == blocksCount {
		f(&StreamExtent{
			Range:            s.vhdFooterRange,
			OwnerVhdUniqueID: s.vhdFile.Footer.UniqueID,
		}, nil)
	}
}