lotus/storage/sealer/storiface/ffi.go

32 lines
635 B
Go
Raw Normal View History

2020-05-19 16:11:56 +00:00
package storiface
import (
2020-12-01 23:35:55 +00:00
"context"
"errors"
2020-12-01 23:39:55 +00:00
2020-12-01 23:35:55 +00:00
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
2020-09-07 03:49:10 +00:00
"github.com/filecoin-project/go-state-types/abi"
)
2020-05-19 16:11:56 +00:00
var ErrSectorNotFound = errors.New("sector not found")
type UnpaddedByteIndex uint64
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
2020-12-01 23:35:55 +00:00
2022-01-18 10:25:04 +00:00
type RGetter func(ctx context.Context, id abi.SectorID) (sealed cid.Cid, update bool, err error)