28 lines
664 B
Go
28 lines
664 B
Go
package miner
|
|
|
|
import (
|
|
"golang.org/x/xerrors"
|
|
|
|
"github.com/filecoin-project/go-bitfield"
|
|
)
|
|
|
|
func AllPartSectors(mas State, sget func(Partition) (bitfield.BitField, error)) (bitfield.BitField, error) {
|
|
var parts []bitfield.BitField
|
|
|
|
err := mas.ForEachDeadline(func(dlidx uint64, dl Deadline) error {
|
|
return dl.ForEachPartition(func(partidx uint64, part Partition) error {
|
|
s, err := sget(part)
|
|
if err != nil {
|
|
return xerrors.Errorf("getting sector list (dl: %d, part %d): %w", dlidx, partidx, err)
|
|
}
|
|
|
|
parts = append(parts, s)
|
|
return nil
|
|
})
|
|
})
|
|
if err != nil {
|
|
return bitfield.BitField{}, err
|
|
}
|
|
|
|
return bitfield.MultiMerge(parts...)
|
|
} |