2020-03-26 02:50:56 +00:00
|
|
|
package ffiwrapper
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io"
|
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
"github.com/ipfs/go-cid"
|
|
|
|
|
2020-03-26 02:50:56 +00:00
|
|
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
|
|
|
"github.com/filecoin-project/specs-storage/storage"
|
|
|
|
|
2020-03-27 23:21:36 +00:00
|
|
|
"github.com/filecoin-project/sector-storage/ffiwrapper/basicfs"
|
|
|
|
"github.com/filecoin-project/sector-storage/stores"
|
2020-05-26 08:25:17 +00:00
|
|
|
"github.com/filecoin-project/sector-storage/storiface"
|
2020-03-26 02:50:56 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
type Validator interface {
|
|
|
|
CanCommit(sector stores.SectorPaths) (bool, error)
|
|
|
|
CanProve(sector stores.SectorPaths) (bool, error)
|
|
|
|
}
|
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
type StorageSealer interface {
|
2020-03-26 02:50:56 +00:00
|
|
|
storage.Sealer
|
|
|
|
storage.Storage
|
|
|
|
}
|
|
|
|
|
2020-03-26 19:34:38 +00:00
|
|
|
type Storage interface {
|
2020-03-26 02:50:56 +00:00
|
|
|
storage.Prover
|
2020-03-26 19:34:38 +00:00
|
|
|
StorageSealer
|
2020-03-26 02:50:56 +00:00
|
|
|
|
2020-05-26 08:25:17 +00:00
|
|
|
UnsealPiece(ctx context.Context, sector abi.SectorID, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error
|
2020-07-30 20:03:43 +00:00
|
|
|
ReadPiece(ctx context.Context, writer io.Writer, sector abi.SectorID, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error)
|
2020-03-26 02:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type Verifier interface {
|
|
|
|
VerifySeal(abi.SealVerifyInfo) (bool, error)
|
2020-04-10 18:41:59 +00:00
|
|
|
VerifyWinningPoSt(ctx context.Context, info abi.WinningPoStVerifyInfo) (bool, error)
|
|
|
|
VerifyWindowPoSt(ctx context.Context, info abi.WindowPoStVerifyInfo) (bool, error)
|
2020-04-17 14:00:21 +00:00
|
|
|
|
2020-06-15 12:32:17 +00:00
|
|
|
GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error)
|
2020-03-26 02:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type SectorProvider interface {
|
2020-05-18 22:08:11 +00:00
|
|
|
// * returns storiface.ErrSectorNotFound if a requested existing sector doesn't exist
|
2020-03-26 02:50:56 +00:00
|
|
|
// * returns an error when allocate is set, and existing isn't, and the sector exists
|
2020-06-04 21:30:20 +00:00
|
|
|
AcquireSector(ctx context.Context, id abi.SectorID, existing stores.SectorFileType, allocate stores.SectorFileType, ptype stores.PathType) (stores.SectorPaths, func(), error)
|
2020-03-26 02:50:56 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var _ SectorProvider = &basicfs.Provider{}
|