add UnpaddedByteIndex.Valid()
This commit is contained in:
parent
e275b54f55
commit
55401116bb
9
extern/sector-storage/storiface/ffi.go
vendored
9
extern/sector-storage/storiface/ffi.go
vendored
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
xerrors "golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
)
|
||||
@ -17,6 +18,14 @@ func (i UnpaddedByteIndex) Padded() PaddedByteIndex {
|
||||
return PaddedByteIndex(abi.UnpaddedPieceSize(i).Padded())
|
||||
}
|
||||
|
||||
func (i UnpaddedByteIndex) Valid() error {
|
||||
if i%127 != 0 {
|
||||
return xerrors.Errorf("unpadded byte index must be a multiple of 127")
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type PaddedByteIndex uint64
|
||||
|
||||
type RGetter func(ctx context.Context, id abi.SectorID) (cid.Cid, error)
|
||||
|
Loading…
Reference in New Issue
Block a user