jldb/mdb/pfile/iterate.go
2023-10-13 11:43:27 +02:00

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())
})
}