package sectorutil import ( "fmt" "golang.org/x/xerrors" "github.com/filecoin-project/specs-actors/actors/abi" ) func ParseSectorID(baseName string) (abi.SectorID, error) { var n abi.SectorNumber var mid abi.ActorID read, err := fmt.Sscanf(baseName, "s-t0%d-%d", &mid, &n) if err != nil { return abi.SectorID{}, xerrors.Errorf(": %w", err) } if read != 2 { return abi.SectorID{}, xerrors.Errorf("parseSectorID expected to scan 2 values, got %d", read) } return abi.SectorID{ Miner: mid, Number: n, }, nil } func SectorName(sid abi.SectorID) string { return fmt.Sprintf("s-t0%d-%d", sid.Miner, sid.Number) }