19 lines
396 B
Go
19 lines
396 B
Go
|
package pfile
|
||
|
|
||
|
import "bytes"
|
||
|
|
||
|
func IterateAllocated(
|
||
|
pf *File,
|
||
|
idx *Index,
|
||
|
each func(collectionID, itemID uint64, data []byte) error,
|
||
|
) error {
|
||
|
buf := &bytes.Buffer{}
|
||
|
return idx.aList.Iterate(func(collectionID, itemID uint64, pages []uint64) error {
|
||
|
buf.Reset()
|
||
|
if err := pf.readData(pages[0], buf); err != nil {
|
||
|
return err
|
||
|
}
|
||
|
return each(collectionID, itemID, buf.Bytes())
|
||
|
})
|
||
|
}
|