diff --git a/api/api_storage.go b/api/api_storage.go index 0584f85fd..e9e409a7f 100644 --- a/api/api_storage.go +++ b/api/api_storage.go @@ -18,7 +18,6 @@ import ( "github.com/filecoin-project/go-state-types/builtin/v8/market" "github.com/filecoin-project/go-state-types/builtin/v8/miner" abinetwork "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/types" @@ -52,7 +51,7 @@ type StorageMiner interface { ComputeWindowPoSt(ctx context.Context, dlIdx uint64, tsk types.TipSetKey) ([]miner.SubmitWindowedPoStParams, error) //perm:admin - ComputeDataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) //perm:admin + ComputeDataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) //perm:admin // Temp api for testing PledgeSector(context.Context) (abi.SectorID, error) //perm:write @@ -63,9 +62,9 @@ type StorageMiner interface { // Add piece to an open sector. If no sectors with enough space are open, // either a new sector will be created, or this call will block until more // sectors can be created. - SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storage.Data, d PieceDealInfo) (SectorOffset, error) //perm:admin + SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storiface.Data, d PieceDealInfo) (SectorOffset, error) //perm:admin - SectorsUnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error //perm:admin + SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error //perm:admin // List all staged sectors SectorsList(context.Context) ([]abi.SectorNumber, error) //perm:read @@ -124,23 +123,23 @@ type StorageMiner interface { WorkerJobs(context.Context) (map[uuid.UUID][]storiface.WorkerJob, error) //perm:admin //storiface.WorkerReturn - ReturnDataCid(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err *storiface.CallError) error //perm:admin retry:true - ReturnAddPiece(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err *storiface.CallError) error //perm:admin retry:true - ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storage.PreCommit1Out, err *storiface.CallError) error //perm:admin retry:true - ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storage.SectorCids, err *storiface.CallError) error //perm:admin retry:true - ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storage.Commit1Out, err *storiface.CallError) error //perm:admin retry:true - ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storage.Proof, err *storiface.CallError) error //perm:admin retry:true - ReturnFinalizeSector(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true - ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storage.ReplicaUpdateOut, err *storiface.CallError) error //perm:admin retry:true - ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, vanillaProofs storage.ReplicaVanillaProofs, err *storiface.CallError) error //perm:admin retry:true - ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, proof storage.ReplicaUpdateProof, err *storiface.CallError) error //perm:admin retry:true - ReturnGenerateSectorKeyFromData(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true - ReturnFinalizeReplicaUpdate(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true - ReturnReleaseUnsealed(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true - ReturnMoveStorage(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true - ReturnUnsealPiece(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true - ReturnReadPiece(ctx context.Context, callID storiface.CallID, ok bool, err *storiface.CallError) error //perm:admin retry:true - ReturnFetch(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true + ReturnDataCid(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err *storiface.CallError) error //perm:admin retry:true + ReturnAddPiece(ctx context.Context, callID storiface.CallID, pi abi.PieceInfo, err *storiface.CallError) error //perm:admin retry:true + ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storiface.PreCommit1Out, err *storiface.CallError) error //perm:admin retry:true + ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storiface.SectorCids, err *storiface.CallError) error //perm:admin retry:true + ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storiface.Commit1Out, err *storiface.CallError) error //perm:admin retry:true + ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storiface.Proof, err *storiface.CallError) error //perm:admin retry:true + ReturnFinalizeSector(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true + ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storiface.ReplicaUpdateOut, err *storiface.CallError) error //perm:admin retry:true + ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, vanillaProofs storiface.ReplicaVanillaProofs, err *storiface.CallError) error //perm:admin retry:true + ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, proof storiface.ReplicaUpdateProof, err *storiface.CallError) error //perm:admin retry:true + ReturnGenerateSectorKeyFromData(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true + ReturnFinalizeReplicaUpdate(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true + ReturnReleaseUnsealed(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true + ReturnMoveStorage(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true + ReturnUnsealPiece(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true + ReturnReadPiece(ctx context.Context, callID storiface.CallID, ok bool, err *storiface.CallError) error //perm:admin retry:true + ReturnFetch(ctx context.Context, callID storiface.CallID, err *storiface.CallError) error //perm:admin retry:true // SealingSchedDiag dumps internal sealing scheduler state SealingSchedDiag(ctx context.Context, doSched bool) (interface{}, error) //perm:admin @@ -272,7 +271,7 @@ type StorageMiner interface { // the path specified when calling CreateBackup is within the base path CreateBackup(ctx context.Context, fpath string) error //perm:admin - CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) //perm:admin + CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) //perm:admin ComputeProof(ctx context.Context, ssi []builtin.ExtendedSectorInfo, rand abi.PoStRandomness, poStEpoch abi.ChainEpoch, nv abinetwork.Version) ([]builtin.PoStProof, error) //perm:read } diff --git a/api/api_worker.go b/api/api_worker.go index 688151a8c..17dac8e3d 100644 --- a/api/api_worker.go +++ b/api/api_worker.go @@ -8,7 +8,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/sealtasks" "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -34,22 +33,22 @@ type Worker interface { Info(context.Context) (storiface.WorkerInfo, error) //perm:admin // storiface.WorkerCalls - DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) //perm:admin - AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) //perm:admin - SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin - SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (storiface.CallID, error) //perm:admin - SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storiface.CallID, error) //perm:admin - SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (storiface.CallID, error) //perm:admin - FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) //perm:admin - FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) //perm:admin - ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin - ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) //perm:admin - ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storiface.CallID, error) //perm:admin - GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) (storiface.CallID, error) //perm:admin - ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (storiface.CallID, error) //perm:admin - MoveStorage(ctx context.Context, sector storage.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin - UnsealPiece(context.Context, storage.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin - Fetch(context.Context, storage.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin + DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) //perm:admin + AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) //perm:admin + SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin + SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.CallID, error) //perm:admin + SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.CallID, error) //perm:admin + SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.CallID, error) //perm:admin + FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin + FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) //perm:admin + ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) //perm:admin + ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) //perm:admin + ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) //perm:admin + GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) (storiface.CallID, error) //perm:admin + ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) (storiface.CallID, error) //perm:admin + MoveStorage(ctx context.Context, sector storiface.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) //perm:admin + UnsealPiece(context.Context, storiface.SectorRef, storiface.UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (storiface.CallID, error) //perm:admin + Fetch(context.Context, storiface.SectorRef, storiface.SectorFileType, storiface.PathType, storiface.AcquireMode) (storiface.CallID, error) //perm:admin GenerateWinningPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, randomness abi.PoStRandomness) ([]proof.PoStProof, error) //perm:admin GenerateWindowPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []storiface.PostSectorChallenge, partitionIdx int, randomness abi.PoStRandomness) (storiface.WindowPoStResult, error) //perm:admin diff --git a/api/proxy_gen.go b/api/proxy_gen.go index 731c8b445..e0cf7ce37 100644 --- a/api/proxy_gen.go +++ b/api/proxy_gen.go @@ -30,7 +30,6 @@ import ( "github.com/filecoin-project/go-state-types/dline" abinetwork "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" apitypes "github.com/filecoin-project/lotus/api/types" "github.com/filecoin-project/lotus/chain/actors/builtin" @@ -655,9 +654,9 @@ type StorageMinerStruct struct { ActorSectorSize func(p0 context.Context, p1 address.Address) (abi.SectorSize, error) `perm:"read"` - CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) `perm:"admin"` + CheckProvable func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) `perm:"admin"` - ComputeDataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (abi.PieceInfo, error) `perm:"admin"` + ComputeDataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) `perm:"admin"` ComputeProof func(p0 context.Context, p1 []builtin.ExtendedSectorInfo, p2 abi.PoStRandomness, p3 abi.ChainEpoch, p4 abinetwork.Version) ([]builtin.PoStProof, error) `perm:"read"` @@ -775,23 +774,23 @@ type StorageMinerStruct struct { ReturnMoveStorage func(p0 context.Context, p1 storiface.CallID, p2 *storiface.CallError) error `perm:"admin"` - ReturnProveReplicaUpdate1 func(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaVanillaProofs, p3 *storiface.CallError) error `perm:"admin"` + ReturnProveReplicaUpdate1 func(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaVanillaProofs, p3 *storiface.CallError) error `perm:"admin"` - ReturnProveReplicaUpdate2 func(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateProof, p3 *storiface.CallError) error `perm:"admin"` + ReturnProveReplicaUpdate2 func(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateProof, p3 *storiface.CallError) error `perm:"admin"` ReturnReadPiece func(p0 context.Context, p1 storiface.CallID, p2 bool, p3 *storiface.CallError) error `perm:"admin"` ReturnReleaseUnsealed func(p0 context.Context, p1 storiface.CallID, p2 *storiface.CallError) error `perm:"admin"` - ReturnReplicaUpdate func(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateOut, p3 *storiface.CallError) error `perm:"admin"` + ReturnReplicaUpdate func(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateOut, p3 *storiface.CallError) error `perm:"admin"` - ReturnSealCommit1 func(p0 context.Context, p1 storiface.CallID, p2 storage.Commit1Out, p3 *storiface.CallError) error `perm:"admin"` + ReturnSealCommit1 func(p0 context.Context, p1 storiface.CallID, p2 storiface.Commit1Out, p3 *storiface.CallError) error `perm:"admin"` - ReturnSealCommit2 func(p0 context.Context, p1 storiface.CallID, p2 storage.Proof, p3 *storiface.CallError) error `perm:"admin"` + ReturnSealCommit2 func(p0 context.Context, p1 storiface.CallID, p2 storiface.Proof, p3 *storiface.CallError) error `perm:"admin"` - ReturnSealPreCommit1 func(p0 context.Context, p1 storiface.CallID, p2 storage.PreCommit1Out, p3 *storiface.CallError) error `perm:"admin"` + ReturnSealPreCommit1 func(p0 context.Context, p1 storiface.CallID, p2 storiface.PreCommit1Out, p3 *storiface.CallError) error `perm:"admin"` - ReturnSealPreCommit2 func(p0 context.Context, p1 storiface.CallID, p2 storage.SectorCids, p3 *storiface.CallError) error `perm:"admin"` + ReturnSealPreCommit2 func(p0 context.Context, p1 storiface.CallID, p2 storiface.SectorCids, p3 *storiface.CallError) error `perm:"admin"` ReturnUnsealPiece func(p0 context.Context, p1 storiface.CallID, p2 *storiface.CallError) error `perm:"admin"` @@ -803,7 +802,7 @@ type StorageMinerStruct struct { SectorAbortUpgrade func(p0 context.Context, p1 abi.SectorNumber) error `perm:"admin"` - SectorAddPieceToAny func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data, p3 PieceDealInfo) (SectorOffset, error) `perm:"admin"` + SectorAddPieceToAny func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data, p3 PieceDealInfo) (SectorOffset, error) `perm:"admin"` SectorCommitFlush func(p0 context.Context) ([]sealiface.CommitBatchRes, error) `perm:"admin"` @@ -845,7 +844,7 @@ type StorageMinerStruct struct { SectorsSummary func(p0 context.Context) (map[SectorState]int, error) `perm:"read"` - SectorsUnsealPiece func(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error `perm:"admin"` + SectorsUnsealPiece func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error `perm:"admin"` SectorsUpdate func(p0 context.Context, p1 abi.SectorNumber, p2 SectorState) error `perm:"admin"` @@ -914,19 +913,19 @@ type WalletStub struct { type WorkerStruct struct { Internal struct { - AddPiece func(p0 context.Context, p1 storage.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storage.Data) (storiface.CallID, error) `perm:"admin"` + AddPiece func(p0 context.Context, p1 storiface.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storiface.Data) (storiface.CallID, error) `perm:"admin"` - DataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (storiface.CallID, error) `perm:"admin"` + DataCid func(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (storiface.CallID, error) `perm:"admin"` Enabled func(p0 context.Context) (bool, error) `perm:"admin"` - Fetch func(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) `perm:"admin"` + Fetch func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) `perm:"admin"` - FinalizeReplicaUpdate func(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) `perm:"admin"` + FinalizeReplicaUpdate func(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) `perm:"admin"` - FinalizeSector func(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) `perm:"admin"` + FinalizeSector func(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) `perm:"admin"` - GenerateSectorKeyFromData func(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid) (storiface.CallID, error) `perm:"admin"` + GenerateSectorKeyFromData func(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid) (storiface.CallID, error) `perm:"admin"` GenerateWindowPoSt func(p0 context.Context, p1 abi.RegisteredPoStProof, p2 abi.ActorID, p3 []storiface.PostSectorChallenge, p4 int, p5 abi.PoStRandomness) (storiface.WindowPoStResult, error) `perm:"admin"` @@ -934,29 +933,29 @@ type WorkerStruct struct { Info func(p0 context.Context) (storiface.WorkerInfo, error) `perm:"admin"` - MoveStorage func(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) `perm:"admin"` + MoveStorage func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) `perm:"admin"` Paths func(p0 context.Context) ([]storiface.StoragePath, error) `perm:"admin"` ProcessSession func(p0 context.Context) (uuid.UUID, error) `perm:"admin"` - ProveReplicaUpdate1 func(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) `perm:"admin"` + ProveReplicaUpdate1 func(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) `perm:"admin"` - ProveReplicaUpdate2 func(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storage.ReplicaVanillaProofs) (storiface.CallID, error) `perm:"admin"` + ProveReplicaUpdate2 func(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storiface.ReplicaVanillaProofs) (storiface.CallID, error) `perm:"admin"` - ReleaseUnsealed func(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) `perm:"admin"` + ReleaseUnsealed func(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) `perm:"admin"` Remove func(p0 context.Context, p1 abi.SectorID) error `perm:"admin"` - ReplicaUpdate func(p0 context.Context, p1 storage.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) `perm:"admin"` + ReplicaUpdate func(p0 context.Context, p1 storiface.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) `perm:"admin"` - SealCommit1 func(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storage.SectorCids) (storiface.CallID, error) `perm:"admin"` + SealCommit1 func(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storiface.SectorCids) (storiface.CallID, error) `perm:"admin"` - SealCommit2 func(p0 context.Context, p1 storage.SectorRef, p2 storage.Commit1Out) (storiface.CallID, error) `perm:"admin"` + SealCommit2 func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.Commit1Out) (storiface.CallID, error) `perm:"admin"` - SealPreCommit1 func(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) `perm:"admin"` + SealPreCommit1 func(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) `perm:"admin"` - SealPreCommit2 func(p0 context.Context, p1 storage.SectorRef, p2 storage.PreCommit1Out) (storiface.CallID, error) `perm:"admin"` + SealPreCommit2 func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.PreCommit1Out) (storiface.CallID, error) `perm:"admin"` Session func(p0 context.Context) (uuid.UUID, error) `perm:"admin"` @@ -970,7 +969,7 @@ type WorkerStruct struct { TaskTypes func(p0 context.Context) (map[sealtasks.TaskType]struct{}, error) `perm:"admin"` - UnsealPiece func(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) `perm:"admin"` + UnsealPiece func(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) `perm:"admin"` Version func(p0 context.Context) (Version, error) `perm:"admin"` @@ -3940,25 +3939,25 @@ func (s *StorageMinerStub) ActorSectorSize(p0 context.Context, p1 address.Addres return *new(abi.SectorSize), ErrNotSupported } -func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) { +func (s *StorageMinerStruct) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) { if s.Internal.CheckProvable == nil { return *new(map[abi.SectorNumber]string), ErrNotSupported } return s.Internal.CheckProvable(p0, p1, p2, p3) } -func (s *StorageMinerStub) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storage.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) { +func (s *StorageMinerStub) CheckProvable(p0 context.Context, p1 abi.RegisteredPoStProof, p2 []storiface.SectorRef, p3 bool) (map[abi.SectorNumber]string, error) { return *new(map[abi.SectorNumber]string), ErrNotSupported } -func (s *StorageMinerStruct) ComputeDataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (abi.PieceInfo, error) { +func (s *StorageMinerStruct) ComputeDataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) { if s.Internal.ComputeDataCid == nil { return *new(abi.PieceInfo), ErrNotSupported } return s.Internal.ComputeDataCid(p0, p1, p2) } -func (s *StorageMinerStub) ComputeDataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (abi.PieceInfo, error) { +func (s *StorageMinerStub) ComputeDataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (abi.PieceInfo, error) { return *new(abi.PieceInfo), ErrNotSupported } @@ -4600,25 +4599,25 @@ func (s *StorageMinerStub) ReturnMoveStorage(p0 context.Context, p1 storiface.Ca return ErrNotSupported } -func (s *StorageMinerStruct) ReturnProveReplicaUpdate1(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaVanillaProofs, p3 *storiface.CallError) error { +func (s *StorageMinerStruct) ReturnProveReplicaUpdate1(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaVanillaProofs, p3 *storiface.CallError) error { if s.Internal.ReturnProveReplicaUpdate1 == nil { return ErrNotSupported } return s.Internal.ReturnProveReplicaUpdate1(p0, p1, p2, p3) } -func (s *StorageMinerStub) ReturnProveReplicaUpdate1(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaVanillaProofs, p3 *storiface.CallError) error { +func (s *StorageMinerStub) ReturnProveReplicaUpdate1(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaVanillaProofs, p3 *storiface.CallError) error { return ErrNotSupported } -func (s *StorageMinerStruct) ReturnProveReplicaUpdate2(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateProof, p3 *storiface.CallError) error { +func (s *StorageMinerStruct) ReturnProveReplicaUpdate2(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateProof, p3 *storiface.CallError) error { if s.Internal.ReturnProveReplicaUpdate2 == nil { return ErrNotSupported } return s.Internal.ReturnProveReplicaUpdate2(p0, p1, p2, p3) } -func (s *StorageMinerStub) ReturnProveReplicaUpdate2(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateProof, p3 *storiface.CallError) error { +func (s *StorageMinerStub) ReturnProveReplicaUpdate2(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateProof, p3 *storiface.CallError) error { return ErrNotSupported } @@ -4644,58 +4643,58 @@ func (s *StorageMinerStub) ReturnReleaseUnsealed(p0 context.Context, p1 storifac return ErrNotSupported } -func (s *StorageMinerStruct) ReturnReplicaUpdate(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateOut, p3 *storiface.CallError) error { +func (s *StorageMinerStruct) ReturnReplicaUpdate(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateOut, p3 *storiface.CallError) error { if s.Internal.ReturnReplicaUpdate == nil { return ErrNotSupported } return s.Internal.ReturnReplicaUpdate(p0, p1, p2, p3) } -func (s *StorageMinerStub) ReturnReplicaUpdate(p0 context.Context, p1 storiface.CallID, p2 storage.ReplicaUpdateOut, p3 *storiface.CallError) error { +func (s *StorageMinerStub) ReturnReplicaUpdate(p0 context.Context, p1 storiface.CallID, p2 storiface.ReplicaUpdateOut, p3 *storiface.CallError) error { return ErrNotSupported } -func (s *StorageMinerStruct) ReturnSealCommit1(p0 context.Context, p1 storiface.CallID, p2 storage.Commit1Out, p3 *storiface.CallError) error { +func (s *StorageMinerStruct) ReturnSealCommit1(p0 context.Context, p1 storiface.CallID, p2 storiface.Commit1Out, p3 *storiface.CallError) error { if s.Internal.ReturnSealCommit1 == nil { return ErrNotSupported } return s.Internal.ReturnSealCommit1(p0, p1, p2, p3) } -func (s *StorageMinerStub) ReturnSealCommit1(p0 context.Context, p1 storiface.CallID, p2 storage.Commit1Out, p3 *storiface.CallError) error { +func (s *StorageMinerStub) ReturnSealCommit1(p0 context.Context, p1 storiface.CallID, p2 storiface.Commit1Out, p3 *storiface.CallError) error { return ErrNotSupported } -func (s *StorageMinerStruct) ReturnSealCommit2(p0 context.Context, p1 storiface.CallID, p2 storage.Proof, p3 *storiface.CallError) error { +func (s *StorageMinerStruct) ReturnSealCommit2(p0 context.Context, p1 storiface.CallID, p2 storiface.Proof, p3 *storiface.CallError) error { if s.Internal.ReturnSealCommit2 == nil { return ErrNotSupported } return s.Internal.ReturnSealCommit2(p0, p1, p2, p3) } -func (s *StorageMinerStub) ReturnSealCommit2(p0 context.Context, p1 storiface.CallID, p2 storage.Proof, p3 *storiface.CallError) error { +func (s *StorageMinerStub) ReturnSealCommit2(p0 context.Context, p1 storiface.CallID, p2 storiface.Proof, p3 *storiface.CallError) error { return ErrNotSupported } -func (s *StorageMinerStruct) ReturnSealPreCommit1(p0 context.Context, p1 storiface.CallID, p2 storage.PreCommit1Out, p3 *storiface.CallError) error { +func (s *StorageMinerStruct) ReturnSealPreCommit1(p0 context.Context, p1 storiface.CallID, p2 storiface.PreCommit1Out, p3 *storiface.CallError) error { if s.Internal.ReturnSealPreCommit1 == nil { return ErrNotSupported } return s.Internal.ReturnSealPreCommit1(p0, p1, p2, p3) } -func (s *StorageMinerStub) ReturnSealPreCommit1(p0 context.Context, p1 storiface.CallID, p2 storage.PreCommit1Out, p3 *storiface.CallError) error { +func (s *StorageMinerStub) ReturnSealPreCommit1(p0 context.Context, p1 storiface.CallID, p2 storiface.PreCommit1Out, p3 *storiface.CallError) error { return ErrNotSupported } -func (s *StorageMinerStruct) ReturnSealPreCommit2(p0 context.Context, p1 storiface.CallID, p2 storage.SectorCids, p3 *storiface.CallError) error { +func (s *StorageMinerStruct) ReturnSealPreCommit2(p0 context.Context, p1 storiface.CallID, p2 storiface.SectorCids, p3 *storiface.CallError) error { if s.Internal.ReturnSealPreCommit2 == nil { return ErrNotSupported } return s.Internal.ReturnSealPreCommit2(p0, p1, p2, p3) } -func (s *StorageMinerStub) ReturnSealPreCommit2(p0 context.Context, p1 storiface.CallID, p2 storage.SectorCids, p3 *storiface.CallError) error { +func (s *StorageMinerStub) ReturnSealPreCommit2(p0 context.Context, p1 storiface.CallID, p2 storiface.SectorCids, p3 *storiface.CallError) error { return ErrNotSupported } @@ -4754,14 +4753,14 @@ func (s *StorageMinerStub) SectorAbortUpgrade(p0 context.Context, p1 abi.SectorN return ErrNotSupported } -func (s *StorageMinerStruct) SectorAddPieceToAny(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data, p3 PieceDealInfo) (SectorOffset, error) { +func (s *StorageMinerStruct) SectorAddPieceToAny(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data, p3 PieceDealInfo) (SectorOffset, error) { if s.Internal.SectorAddPieceToAny == nil { return *new(SectorOffset), ErrNotSupported } return s.Internal.SectorAddPieceToAny(p0, p1, p2, p3) } -func (s *StorageMinerStub) SectorAddPieceToAny(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data, p3 PieceDealInfo) (SectorOffset, error) { +func (s *StorageMinerStub) SectorAddPieceToAny(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data, p3 PieceDealInfo) (SectorOffset, error) { return *new(SectorOffset), ErrNotSupported } @@ -4985,14 +4984,14 @@ func (s *StorageMinerStub) SectorsSummary(p0 context.Context) (map[SectorState]i return *new(map[SectorState]int), ErrNotSupported } -func (s *StorageMinerStruct) SectorsUnsealPiece(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error { +func (s *StorageMinerStruct) SectorsUnsealPiece(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error { if s.Internal.SectorsUnsealPiece == nil { return ErrNotSupported } return s.Internal.SectorsUnsealPiece(p0, p1, p2, p3, p4, p5) } -func (s *StorageMinerStub) SectorsUnsealPiece(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error { +func (s *StorageMinerStub) SectorsUnsealPiece(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 *cid.Cid) error { return ErrNotSupported } @@ -5271,25 +5270,25 @@ func (s *WalletStub) WalletSign(p0 context.Context, p1 address.Address, p2 []byt return nil, ErrNotSupported } -func (s *WorkerStruct) AddPiece(p0 context.Context, p1 storage.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storage.Data) (storiface.CallID, error) { +func (s *WorkerStruct) AddPiece(p0 context.Context, p1 storiface.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storiface.Data) (storiface.CallID, error) { if s.Internal.AddPiece == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.AddPiece(p0, p1, p2, p3, p4) } -func (s *WorkerStub) AddPiece(p0 context.Context, p1 storage.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storage.Data) (storiface.CallID, error) { +func (s *WorkerStub) AddPiece(p0 context.Context, p1 storiface.SectorRef, p2 []abi.UnpaddedPieceSize, p3 abi.UnpaddedPieceSize, p4 storiface.Data) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) DataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (storiface.CallID, error) { +func (s *WorkerStruct) DataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (storiface.CallID, error) { if s.Internal.DataCid == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.DataCid(p0, p1, p2) } -func (s *WorkerStub) DataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storage.Data) (storiface.CallID, error) { +func (s *WorkerStub) DataCid(p0 context.Context, p1 abi.UnpaddedPieceSize, p2 storiface.Data) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } @@ -5304,47 +5303,47 @@ func (s *WorkerStub) Enabled(p0 context.Context) (bool, error) { return false, ErrNotSupported } -func (s *WorkerStruct) Fetch(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) { +func (s *WorkerStruct) Fetch(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) { if s.Internal.Fetch == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.Fetch(p0, p1, p2, p3, p4) } -func (s *WorkerStub) Fetch(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) { +func (s *WorkerStub) Fetch(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType, p3 storiface.PathType, p4 storiface.AcquireMode) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) FinalizeReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) { +func (s *WorkerStruct) FinalizeReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) { if s.Internal.FinalizeReplicaUpdate == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.FinalizeReplicaUpdate(p0, p1, p2) } -func (s *WorkerStub) FinalizeReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) { +func (s *WorkerStub) FinalizeReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) FinalizeSector(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) { +func (s *WorkerStruct) FinalizeSector(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) { if s.Internal.FinalizeSector == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.FinalizeSector(p0, p1, p2) } -func (s *WorkerStub) FinalizeSector(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) { +func (s *WorkerStub) FinalizeSector(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) GenerateSectorKeyFromData(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid) (storiface.CallID, error) { +func (s *WorkerStruct) GenerateSectorKeyFromData(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid) (storiface.CallID, error) { if s.Internal.GenerateSectorKeyFromData == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.GenerateSectorKeyFromData(p0, p1, p2) } -func (s *WorkerStub) GenerateSectorKeyFromData(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid) (storiface.CallID, error) { +func (s *WorkerStub) GenerateSectorKeyFromData(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } @@ -5381,14 +5380,14 @@ func (s *WorkerStub) Info(p0 context.Context) (storiface.WorkerInfo, error) { return *new(storiface.WorkerInfo), ErrNotSupported } -func (s *WorkerStruct) MoveStorage(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) { +func (s *WorkerStruct) MoveStorage(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) { if s.Internal.MoveStorage == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.MoveStorage(p0, p1, p2) } -func (s *WorkerStub) MoveStorage(p0 context.Context, p1 storage.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) { +func (s *WorkerStub) MoveStorage(p0 context.Context, p1 storiface.SectorRef, p2 storiface.SectorFileType) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } @@ -5414,36 +5413,36 @@ func (s *WorkerStub) ProcessSession(p0 context.Context) (uuid.UUID, error) { return *new(uuid.UUID), ErrNotSupported } -func (s *WorkerStruct) ProveReplicaUpdate1(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) { +func (s *WorkerStruct) ProveReplicaUpdate1(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) { if s.Internal.ProveReplicaUpdate1 == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.ProveReplicaUpdate1(p0, p1, p2, p3, p4) } -func (s *WorkerStub) ProveReplicaUpdate1(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) { +func (s *WorkerStub) ProveReplicaUpdate1(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) ProveReplicaUpdate2(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storage.ReplicaVanillaProofs) (storiface.CallID, error) { +func (s *WorkerStruct) ProveReplicaUpdate2(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storiface.ReplicaVanillaProofs) (storiface.CallID, error) { if s.Internal.ProveReplicaUpdate2 == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.ProveReplicaUpdate2(p0, p1, p2, p3, p4, p5) } -func (s *WorkerStub) ProveReplicaUpdate2(p0 context.Context, p1 storage.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storage.ReplicaVanillaProofs) (storiface.CallID, error) { +func (s *WorkerStub) ProveReplicaUpdate2(p0 context.Context, p1 storiface.SectorRef, p2 cid.Cid, p3 cid.Cid, p4 cid.Cid, p5 storiface.ReplicaVanillaProofs) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) ReleaseUnsealed(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) { +func (s *WorkerStruct) ReleaseUnsealed(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) { if s.Internal.ReleaseUnsealed == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.ReleaseUnsealed(p0, p1, p2) } -func (s *WorkerStub) ReleaseUnsealed(p0 context.Context, p1 storage.SectorRef, p2 []storage.Range) (storiface.CallID, error) { +func (s *WorkerStub) ReleaseUnsealed(p0 context.Context, p1 storiface.SectorRef, p2 []storiface.Range) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } @@ -5458,58 +5457,58 @@ func (s *WorkerStub) Remove(p0 context.Context, p1 abi.SectorID) error { return ErrNotSupported } -func (s *WorkerStruct) ReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) { +func (s *WorkerStruct) ReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) { if s.Internal.ReplicaUpdate == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.ReplicaUpdate(p0, p1, p2) } -func (s *WorkerStub) ReplicaUpdate(p0 context.Context, p1 storage.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) { +func (s *WorkerStub) ReplicaUpdate(p0 context.Context, p1 storiface.SectorRef, p2 []abi.PieceInfo) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) SealCommit1(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storage.SectorCids) (storiface.CallID, error) { +func (s *WorkerStruct) SealCommit1(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storiface.SectorCids) (storiface.CallID, error) { if s.Internal.SealCommit1 == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.SealCommit1(p0, p1, p2, p3, p4, p5) } -func (s *WorkerStub) SealCommit1(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storage.SectorCids) (storiface.CallID, error) { +func (s *WorkerStub) SealCommit1(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 abi.InteractiveSealRandomness, p4 []abi.PieceInfo, p5 storiface.SectorCids) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) SealCommit2(p0 context.Context, p1 storage.SectorRef, p2 storage.Commit1Out) (storiface.CallID, error) { +func (s *WorkerStruct) SealCommit2(p0 context.Context, p1 storiface.SectorRef, p2 storiface.Commit1Out) (storiface.CallID, error) { if s.Internal.SealCommit2 == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.SealCommit2(p0, p1, p2) } -func (s *WorkerStub) SealCommit2(p0 context.Context, p1 storage.SectorRef, p2 storage.Commit1Out) (storiface.CallID, error) { +func (s *WorkerStub) SealCommit2(p0 context.Context, p1 storiface.SectorRef, p2 storiface.Commit1Out) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) SealPreCommit1(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) { +func (s *WorkerStruct) SealPreCommit1(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) { if s.Internal.SealPreCommit1 == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.SealPreCommit1(p0, p1, p2, p3) } -func (s *WorkerStub) SealPreCommit1(p0 context.Context, p1 storage.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) { +func (s *WorkerStub) SealPreCommit1(p0 context.Context, p1 storiface.SectorRef, p2 abi.SealRandomness, p3 []abi.PieceInfo) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } -func (s *WorkerStruct) SealPreCommit2(p0 context.Context, p1 storage.SectorRef, p2 storage.PreCommit1Out) (storiface.CallID, error) { +func (s *WorkerStruct) SealPreCommit2(p0 context.Context, p1 storiface.SectorRef, p2 storiface.PreCommit1Out) (storiface.CallID, error) { if s.Internal.SealPreCommit2 == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.SealPreCommit2(p0, p1, p2) } -func (s *WorkerStub) SealPreCommit2(p0 context.Context, p1 storage.SectorRef, p2 storage.PreCommit1Out) (storiface.CallID, error) { +func (s *WorkerStub) SealPreCommit2(p0 context.Context, p1 storiface.SectorRef, p2 storiface.PreCommit1Out) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } @@ -5579,14 +5578,14 @@ func (s *WorkerStub) TaskTypes(p0 context.Context) (map[sealtasks.TaskType]struc return *new(map[sealtasks.TaskType]struct{}), ErrNotSupported } -func (s *WorkerStruct) UnsealPiece(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) { +func (s *WorkerStruct) UnsealPiece(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) { if s.Internal.UnsealPiece == nil { return *new(storiface.CallID), ErrNotSupported } return s.Internal.UnsealPiece(p0, p1, p2, p3, p4, p5) } -func (s *WorkerStub) UnsealPiece(p0 context.Context, p1 storage.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) { +func (s *WorkerStub) UnsealPiece(p0 context.Context, p1 storiface.SectorRef, p2 storiface.UnpaddedByteIndex, p3 abi.UnpaddedPieceSize, p4 abi.SealRandomness, p5 cid.Cid) (storiface.CallID, error) { return *new(storiface.CallID), ErrNotSupported } diff --git a/build/openrpc/full.json.gz b/build/openrpc/full.json.gz index a7ef3c09b..fbed500be 100644 Binary files a/build/openrpc/full.json.gz and b/build/openrpc/full.json.gz differ diff --git a/build/openrpc/gateway.json.gz b/build/openrpc/gateway.json.gz index 5a978a54f..5cc7832a4 100644 Binary files a/build/openrpc/gateway.json.gz and b/build/openrpc/gateway.json.gz differ diff --git a/build/openrpc/miner.json.gz b/build/openrpc/miner.json.gz index fcb97b535..ae3fb0319 100644 Binary files a/build/openrpc/miner.json.gz and b/build/openrpc/miner.json.gz differ diff --git a/build/openrpc/worker.json.gz b/build/openrpc/worker.json.gz index 2aa22fe66..406cab94c 100644 Binary files a/build/openrpc/worker.json.gz and b/build/openrpc/worker.json.gz differ diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index 6803fd902..46c008d8f 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -22,7 +22,6 @@ import ( "github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-state-types/abi" prooftypes "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -537,7 +536,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par return nil, nil, fmt.Errorf("parallelism factor must cleanly divide numSectors") } for i := abi.SectorNumber(0); i < abi.SectorNumber(numSectors); i++ { - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: i, @@ -569,7 +568,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par start := worker * sectorsPerWorker end := start + sectorsPerWorker for i := abi.SectorNumber(start); i < abi.SectorNumber(end); i++ { - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: i, @@ -643,7 +642,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par } } - var proof storage.Proof + var proof storiface.Proof if !skipc2 { proof, err = sb.SealCommit2(context.TODO(), sid, c1o) if err != nil { @@ -780,7 +779,7 @@ var proveCmd = &cli.Command{ return err } - ref := storage.SectorRef{ + ref := storiface.SectorRef{ ID: abi.SectorID{ Miner: abi.ActorID(mid), Number: abi.SectorNumber(c2in.SectorNum), diff --git a/cmd/lotus-bench/simple.go b/cmd/lotus-bench/simple.go index 7ddf161aa..b999cd277 100644 --- a/cmd/lotus-bench/simple.go +++ b/cmd/lotus-bench/simple.go @@ -20,7 +20,6 @@ import ( "github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-state-types/abi" prf "github.com/filecoin-project/specs-actors/actors/runtime/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/build" lcli "github.com/filecoin-project/lotus/cli" @@ -122,7 +121,7 @@ p: pvC0JBrEyUqtIIUvB2UUx/2a24c3Cvnu6AZ0D3IMBYAu... type benchSectorProvider map[storiface.SectorFileType]string -func (b benchSectorProvider) AcquireSector(ctx context.Context, id storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) { +func (b benchSectorProvider) AcquireSector(ctx context.Context, id storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) { out := storiface.SectorPaths{ ID: id.ID, Unsealed: b[storiface.FTUnsealed], @@ -178,7 +177,7 @@ var simpleAddPiece = &cli.Command{ return err } - sr := storage.SectorRef{ + sr := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: 1, @@ -251,7 +250,7 @@ var simplePreCommit1 = &cli.Command{ return err } - sr := storage.SectorRef{ + sr := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: 1, @@ -329,7 +328,7 @@ var simplePreCommit2 = &cli.Command{ return err } - sr := storage.SectorRef{ + sr := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: 1, @@ -395,7 +394,7 @@ var simpleCommit1 = &cli.Command{ return err } - sr := storage.SectorRef{ + sr := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: 1, @@ -422,7 +421,7 @@ var simpleCommit1 = &cli.Command{ Size: abi.PaddedPieceSize(sectorSize), PieceCID: commd, }, - }, storage.SectorCids{ + }, storiface.SectorCids{ Unsealed: commd, Sealed: commr, }) @@ -507,7 +506,7 @@ var simpleCommit2 = &cli.Command{ return err } - ref := storage.SectorRef{ + ref := storiface.SectorRef{ ID: abi.SectorID{ Miner: abi.ActorID(mid), Number: abi.SectorNumber(c2in.SectorNum), @@ -755,7 +754,7 @@ var simpleReplicaUpdate = &cli.Command{ if err != nil { return err } - sr := storage.SectorRef{ + sr := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: 1, @@ -823,7 +822,7 @@ var simpleProveReplicaUpdate1 = &cli.Command{ return err } - sr := storage.SectorRef{ + sr := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: 1, @@ -910,7 +909,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{ return err } - sr := storage.SectorRef{ + sr := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: 1, @@ -940,7 +939,7 @@ var simpleProveReplicaUpdate2 = &cli.Command{ return xerrors.Errorf("reading valilla proof file: %w", err) } - var vp storage.ReplicaVanillaProofs + var vp storiface.ReplicaVanillaProofs if err := json.Unmarshal(vpb, &vp); err != nil { return xerrors.Errorf("unmarshalling vanilla proofs: %w", err) } diff --git a/cmd/lotus-miner/proving.go b/cmd/lotus-miner/proving.go index 00531462a..f7fb460ce 100644 --- a/cmd/lotus-miner/proving.go +++ b/cmd/lotus-miner/proving.go @@ -14,7 +14,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -477,7 +476,7 @@ var provingCheckProvableCmd = &cli.Command{ return err } - var tocheck []storage.SectorRef + var tocheck []storiface.SectorRef for _, info := range sectorInfos { si := abi.SectorID{ Miner: abi.ActorID(mid), @@ -491,7 +490,7 @@ var provingCheckProvableCmd = &cli.Command{ } sectors[info.SectorNumber] = struct{}{} - tocheck = append(tocheck, storage.SectorRef{ + tocheck = append(tocheck, storiface.SectorRef{ ProofType: info.SealProof, ID: si, }) diff --git a/cmd/lotus-seed/seed/seed.go b/cmd/lotus-seed/seed/seed.go index 5af234e5c..2816d398e 100644 --- a/cmd/lotus-seed/seed/seed.go +++ b/cmd/lotus-seed/seed/seed.go @@ -23,7 +23,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" market8 "github.com/filecoin-project/go-state-types/builtin/v8/market" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/wallet/key" @@ -65,7 +64,7 @@ func PreSeal(maddr address.Address, spt abi.RegisteredSealProof, offset abi.Sect var sealedSectors []*genesis.PreSeal for i := 0; i < sectors; i++ { sid := abi.SectorID{Miner: abi.ActorID(mid), Number: next} - ref := storage.SectorRef{ID: sid, ProofType: spt} + ref := storiface.SectorRef{ID: sid, ProofType: spt} next++ var preseal *genesis.PreSeal @@ -145,7 +144,7 @@ func PreSeal(maddr address.Address, spt abi.RegisteredSealProof, offset abi.Sect return miner, &minerAddr.KeyInfo, nil } -func presealSector(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, sid storage.SectorRef, ssize abi.SectorSize, preimage []byte) (*genesis.PreSeal, error) { +func presealSector(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, sid storiface.SectorRef, ssize abi.SectorSize, preimage []byte) (*genesis.PreSeal, error) { pi, err := sb.AddPiece(context.TODO(), sid, nil, abi.PaddedPieceSize(ssize).Unpadded(), rand.Reader) if err != nil { return nil, err @@ -184,7 +183,7 @@ func presealSector(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, sid storage.Se }, nil } -func presealSectorFake(sbfs *basicfs.Provider, sid storage.SectorRef, ssize abi.SectorSize) (*genesis.PreSeal, error) { +func presealSectorFake(sbfs *basicfs.Provider, sid storiface.SectorRef, ssize abi.SectorSize) (*genesis.PreSeal, error) { paths, done, err := sbfs.AcquireSector(context.TODO(), sid, 0, storiface.FTSealed|storiface.FTCache, storiface.PathSealing) if err != nil { return nil, xerrors.Errorf("acquire unsealed sector: %w", err) @@ -208,7 +207,7 @@ func presealSectorFake(sbfs *basicfs.Provider, sid storage.SectorRef, ssize abi. }, nil } -func cleanupUnsealed(sbfs *basicfs.Provider, ref storage.SectorRef) error { +func cleanupUnsealed(sbfs *basicfs.Provider, ref storiface.SectorRef) error { paths, done, err := sbfs.AcquireSector(context.TODO(), ref, storiface.FTUnsealed, storiface.FTNone, storiface.PathSealing) if err != nil { return err diff --git a/go.mod b/go.mod index fa0173dec..af37086fb 100644 --- a/go.mod +++ b/go.mod @@ -56,7 +56,6 @@ require ( github.com/filecoin-project/specs-actors/v6 v6.0.2 github.com/filecoin-project/specs-actors/v7 v7.0.1 github.com/filecoin-project/specs-actors/v8 v8.0.1 - github.com/filecoin-project/specs-storage v0.4.1 github.com/filecoin-project/test-vectors/schema v0.0.5 github.com/gbrlsnchs/jwt/v3 v3.0.1 github.com/gdamore/tcell/v2 v2.2.0 diff --git a/go.sum b/go.sum index 18a145315..3f4417e09 100644 --- a/go.sum +++ b/go.sum @@ -370,7 +370,6 @@ github.com/filecoin-project/go-state-types v0.0.0-20201102161440-c8033295a1fc/go github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= github.com/filecoin-project/go-state-types v0.1.1-0.20210810190654-139e0e79e69e/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= github.com/filecoin-project/go-state-types v0.1.3/go.mod h1:ezYnPf0bNkTsDibL/psSz5dy4B5awOJ/E7P2Saeep8g= -github.com/filecoin-project/go-state-types v0.1.4/go.mod h1:xCA/WfKlC2zcn3fUmDv4IrzznwS98X5XW/irUP3Lhxg= github.com/filecoin-project/go-state-types v0.1.5/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= @@ -415,8 +414,6 @@ github.com/filecoin-project/specs-actors/v7 v7.0.1 h1:w72xCxijK7xs1qzmJiw+WYJaVt github.com/filecoin-project/specs-actors/v7 v7.0.1/go.mod h1:tPLEYXoXhcpyLh69Ccq91SOuLXsPWjHiY27CzawjUEk= github.com/filecoin-project/specs-actors/v8 v8.0.1 h1:4u0tIRJeT5G7F05lwLRIsDnsrN+bJ5Ixj6h49Q7uE2Y= github.com/filecoin-project/specs-actors/v8 v8.0.1/go.mod h1:UYIPg65iPWoFw5NEftREdJwv9b/5yaLKdCgTvNI/2FA= -github.com/filecoin-project/specs-storage v0.4.1 h1:yvLEaLZj8f+uByhNC4mFOtCUyL2wQku+NGBp6hjTe9M= -github.com/filecoin-project/specs-storage v0.4.1/go.mod h1:Z2eK6uMwAOSLjek6+sy0jNV2DSsMEENziMUz0GHRFBw= github.com/filecoin-project/storetheindex v0.4.0 h1:MPIDJYBknPbwBcVf+2/WEIK6LKxhZmfQGCrqKmvhFyU= github.com/filecoin-project/storetheindex v0.4.0/go.mod h1:LIwqpXoKeGxOGEjmxPfdYVPQYoZOSI3oXMUd9XTCpjc= github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg= diff --git a/itests/wdpost_test.go b/itests/wdpost_test.go index 66857401c..63a599094 100644 --- a/itests/wdpost_test.go +++ b/itests/wdpost_test.go @@ -13,7 +13,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -21,6 +20,7 @@ import ( "github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/node/impl" "github.com/filecoin-project/lotus/storage/sealer/mock" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) func TestWindowedPost(t *testing.T) { @@ -105,7 +105,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, // Drop the partition err = secs.ForEach(func(sid uint64) error { - return miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkCorrupted(storage.SectorRef{ + return miner.StorageMiner.(*impl.StorageMinerAPI).IStorageMgr.(*mock.SectorMgr).MarkCorrupted(storiface.SectorRef{ ID: abi.SectorID{ Miner: abi.ActorID(mid), Number: abi.SectorNumber(sid), @@ -115,7 +115,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, require.NoError(t, err) } - var s storage.SectorRef + var s storiface.SectorRef // Drop 1 sectors from deadline 3 partition 0 { @@ -137,7 +137,7 @@ func testWindowPostUpgrade(t *testing.T, blocktime time.Duration, nSectors int, require.NoError(t, err) t.Log("the sectors", all) - s = storage.SectorRef{ + s = storiface.SectorRef{ ID: abi.SectorID{ Miner: abi.ActorID(mid), Number: abi.SectorNumber(sn), diff --git a/itests/worker_test.go b/itests/worker_test.go index 3f8a3e628..28e4cc31a 100644 --- a/itests/worker_test.go +++ b/itests/worker_test.go @@ -13,7 +13,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" - storage2 "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/types" @@ -206,7 +205,7 @@ func TestWindowPostWorker(t *testing.T) { t.Logf("Drop sector %d; dl %d part %d", sid, di.Index+1, 0) - err = miner.BaseAPI.(*impl.StorageMinerAPI).IStorageMgr.Remove(ctx, storage2.SectorRef{ + err = miner.BaseAPI.(*impl.StorageMinerAPI).IStorageMgr.Remove(ctx, storiface.SectorRef{ ID: abi.SectorID{ Miner: abi.ActorID(mid), Number: abi.SectorNumber(sid), diff --git a/markets/sectoraccessor/sectoraccessor.go b/markets/sectoraccessor/sectoraccessor.go index a01895bb8..9b709d3b5 100644 --- a/markets/sectoraccessor/sectoraccessor.go +++ b/markets/sectoraccessor/sectoraccessor.go @@ -12,7 +12,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-state-types/abi" - specstorage "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/v1api" @@ -55,7 +54,7 @@ func (sa *sectorAccessor) UnsealSectorAt(ctx context.Context, sectorID abi.Secto return nil, err } - ref := specstorage.SectorRef{ + ref := storiface.SectorRef{ ID: abi.SectorID{ Miner: abi.ActorID(mid), Number: sectorID, @@ -90,7 +89,7 @@ func (sa *sectorAccessor) IsUnsealed(ctx context.Context, sectorID abi.SectorNum return false, err } - ref := specstorage.SectorRef{ + ref := storiface.SectorRef{ ID: abi.SectorID{ Miner: abi.ActorID(mid), Number: sectorID, diff --git a/node/builder_miner.go b/node/builder_miner.go index 17cd5d293..fa214ca9f 100644 --- a/node/builder_miner.go +++ b/node/builder_miner.go @@ -13,7 +13,6 @@ import ( "github.com/filecoin-project/go-fil-markets/storagemarket/impl/storedask" "github.com/filecoin-project/go-state-types/abi" provider "github.com/filecoin-project/index-provider" - storage2 "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -104,7 +103,7 @@ func ConfigStorageMiner(c interface{}) Option { // Sector storage: Proofs Override(new(ffiwrapper.Verifier), ffiwrapper.ProofVerifier), Override(new(ffiwrapper.Prover), ffiwrapper.ProofProver), - Override(new(storage2.Prover), From(new(sectorstorage.SectorManager))), + Override(new(storiface.Prover), From(new(sectorstorage.SectorManager))), // Sealing (todo should be under EnableSealing, but storagefsm is currently bundled with storage.Miner) Override(new(sealing.SectorIDCounter), modules.SectorIDCounter), diff --git a/node/impl/storminer.go b/node/impl/storminer.go index 80410ac9a..3b753bf82 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -34,7 +34,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner" "github.com/filecoin-project/go-state-types/network" - sto "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" apitypes "github.com/filecoin-project/lotus/api/types" @@ -222,7 +221,7 @@ func (sm *StorageMinerAPI) SectorsStatus(ctx context.Context, sid abi.SectorNumb return sInfo, nil } -func (sm *StorageMinerAPI) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r sto.Data, d api.PieceDealInfo) (api.SectorOffset, error) { +func (sm *StorageMinerAPI) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storiface.Data, d api.PieceDealInfo) (api.SectorOffset, error) { so, err := sm.Miner.SectorAddPieceToAny(ctx, size, r, d) if err != nil { // jsonrpc doesn't support returning values with errors, make sure we never do that @@ -232,7 +231,7 @@ func (sm *StorageMinerAPI) SectorAddPieceToAny(ctx context.Context, size abi.Unp return so, nil } -func (sm *StorageMinerAPI) SectorsUnsealPiece(ctx context.Context, sector sto.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error { +func (sm *StorageMinerAPI) SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error { return sm.StorageMgr.SectorsUnsealPiece(ctx, sector, offset, size, randomness, commd) } @@ -425,7 +424,7 @@ func (sm *StorageMinerAPI) ComputeWindowPoSt(ctx context.Context, dlIdx uint64, return sm.WdPoSt.ComputePoSt(ctx, dlIdx, ts) } -func (sm *StorageMinerAPI) ComputeDataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData sto.Data) (abi.PieceInfo, error) { +func (sm *StorageMinerAPI) ComputeDataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) { return sm.StorageMgr.DataCid(ctx, pieceSize, pieceData) } @@ -1224,7 +1223,7 @@ func (sm *StorageMinerAPI) CreateBackup(ctx context.Context, fpath string) error return backup(ctx, sm.DS, fpath) } -func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []sto.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) { +func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) { var rg storiface.RGetter if expensive { rg = func(ctx context.Context, id abi.SectorID) (cid.Cid, bool, error) { diff --git a/storage/miner.go b/storage/miner.go index 8f627a45b..b3c0d4a79 100644 --- a/storage/miner.go +++ b/storage/miner.go @@ -18,7 +18,6 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api/v1api" @@ -35,6 +34,7 @@ import ( pipeline "github.com/filecoin-project/lotus/storage/pipeline" "github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) var log = logging.Logger("storageminer") @@ -240,13 +240,13 @@ func (m *Miner) runPreflightChecks(ctx context.Context) error { } type StorageWpp struct { - prover storage.Prover + prover storiface.Prover verifier ffiwrapper.Verifier miner abi.ActorID winnRpt abi.RegisteredPoStProof } -func NewWinningPoStProver(api v1api.FullNode, prover storage.Prover, verifier ffiwrapper.Verifier, miner dtypes.MinerID) (*StorageWpp, error) { +func NewWinningPoStProver(api v1api.FullNode, prover storiface.Prover, verifier ffiwrapper.Verifier, miner dtypes.MinerID) (*StorageWpp, error) { ma, err := address.NewIDAddress(uint64(miner)) if err != nil { return nil, err diff --git a/storage/miner_sealing.go b/storage/miner_sealing.go index 04f112823..11db5a845 100644 --- a/storage/miner_sealing.go +++ b/storage/miner_sealing.go @@ -9,11 +9,11 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" pipeline "github.com/filecoin-project/lotus/storage/pipeline" "github.com/filecoin-project/lotus/storage/pipeline/sealiface" + "github.com/filecoin-project/lotus/storage/sealer/storiface" "github.com/filecoin-project/lotus/storage/sectorblocks" ) @@ -31,7 +31,7 @@ func (m *Miner) ListSectors() ([]pipeline.SectorInfo, error) { return m.sealing.ListSectors() } -func (m *Miner) PledgeSector(ctx context.Context) (storage.SectorRef, error) { +func (m *Miner) PledgeSector(ctx context.Context) (storiface.SectorRef, error) { return m.sealing.PledgeSector(ctx) } @@ -86,7 +86,7 @@ func (m *Miner) SectorAbortUpgrade(sectorNum abi.SectorNumber) error { return m.sealing.AbortUpgrade(sectorNum) } -func (m *Miner) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storage.Data, d api.PieceDealInfo) (api.SectorOffset, error) { +func (m *Miner) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storiface.Data, d api.PieceDealInfo) (api.SectorOffset, error) { return m.sealing.SectorAddPieceToAny(ctx, size, r, d) } diff --git a/storage/paths/http_handler.go b/storage/paths/http_handler.go index f15afbf3d..c8f465f25 100644 --- a/storage/paths/http_handler.go +++ b/storage/paths/http_handler.go @@ -13,7 +13,6 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/partialfile" "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -105,7 +104,7 @@ func (handler *FetchHandler) remoteGetSector(w http.ResponseWriter, r *http.Requ // The caller has a lock on this sector already, no need to get one here // passing 0 spt because we don't allocate anything - si := storage.SectorRef{ + si := storiface.SectorRef{ ID: id, ProofType: 0, } @@ -238,7 +237,7 @@ func (handler *FetchHandler) remoteGetAllocated(w http.ResponseWriter, r *http.R // The caller has a lock on this sector already, no need to get one here // passing 0 spt because we don't allocate anything - si := storage.SectorRef{ + si := storiface.SectorRef{ ID: id, ProofType: 0, } diff --git a/storage/paths/http_handler_test.go b/storage/paths/http_handler_test.go index 624f264ff..b03fd20ee 100644 --- a/storage/paths/http_handler_test.go +++ b/storage/paths/http_handler_test.go @@ -14,7 +14,6 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/paths/mocks" @@ -26,7 +25,7 @@ func TestRemoteGetAllocated(t *testing.T) { emptyPartialFile := &partialfile.PartialFile{} pfPath := "path" - expectedSectorRef := storage.SectorRef{ + expectedSectorRef := storiface.SectorRef{ ID: abi.SectorID{ Miner: 123, Number: 123, @@ -255,7 +254,7 @@ func TestRemoteGetSector(t *testing.T) { validSectorName := fmt.Sprintf("s-t0%d-%d", 123, 123) validSectorFileType := storiface.FTUnsealed.String() - expectedSectorRef := storage.SectorRef{ + expectedSectorRef := storiface.SectorRef{ ID: abi.SectorID{ Miner: 123, Number: 123, diff --git a/storage/paths/interface.go b/storage/paths/interface.go index 6b5519bf4..b0e714c13 100644 --- a/storage/paths/interface.go +++ b/storage/paths/interface.go @@ -5,7 +5,6 @@ import ( "os" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/fsutil" "github.com/filecoin-project/lotus/storage/sealer/partialfile" @@ -34,7 +33,7 @@ type PartialFileHandler interface { //go:generate go run github.com/golang/mock/mockgen -destination=mocks/store.go -package=mocks . Store type Store interface { - AcquireSector(ctx context.Context, s storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType, op storiface.AcquireMode) (paths storiface.SectorPaths, stores storiface.SectorPaths, err error) + AcquireSector(ctx context.Context, s storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType, op storiface.AcquireMode) (paths storiface.SectorPaths, stores storiface.SectorPaths, err error) Remove(ctx context.Context, s abi.SectorID, types storiface.SectorFileType, force bool, keepIn []storiface.ID) error // like remove, but doesn't remove the primary sector copy, nor the last @@ -42,11 +41,11 @@ type Store interface { RemoveCopies(ctx context.Context, s abi.SectorID, types storiface.SectorFileType) error // move sectors into storage - MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error + MoveStorage(ctx context.Context, s storiface.SectorRef, types storiface.SectorFileType) error FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, error) - Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) + Reserve(ctx context.Context, sid storiface.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) GenerateSingleVanillaProof(ctx context.Context, minerID abi.ActorID, si storiface.PostSectorChallenge, ppt abi.RegisteredPoStProof) ([]byte, error) } diff --git a/storage/paths/local.go b/storage/paths/local.go index e8f463533..4e5c934ad 100644 --- a/storage/paths/local.go +++ b/storage/paths/local.go @@ -16,7 +16,6 @@ import ( ffi "github.com/filecoin-project/filecoin-ffi" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/fsutil" "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -369,7 +368,7 @@ func (st *Local) reportStorage(ctx context.Context) { } } -func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) { +func (st *Local) Reserve(ctx context.Context, sid storiface.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) { ssize, err := sid.ProofType.SectorSize() if err != nil { return nil, err @@ -430,7 +429,7 @@ func (st *Local) Reserve(ctx context.Context, sid storage.SectorRef, ft storifac return done, nil } -func (st *Local) AcquireSector(ctx context.Context, sid storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) { +func (st *Local) AcquireSector(ctx context.Context, sid storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) { if existing|allocate != existing^allocate { return storiface.SectorPaths{}, storiface.SectorPaths{}, xerrors.New("can't both find and allocate a sector") } @@ -645,7 +644,7 @@ func (st *Local) removeSector(ctx context.Context, sid abi.SectorID, typ storifa return nil } -func (st *Local) MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error { +func (st *Local) MoveStorage(ctx context.Context, s storiface.SectorRef, types storiface.SectorFileType) error { dest, destIds, err := st.AcquireSector(ctx, s, storiface.FTNone, types, storiface.PathStorage, storiface.AcquireMove) if err != nil { return xerrors.Errorf("acquire dest storage: %w", err) @@ -717,7 +716,7 @@ func (st *Local) FsStat(ctx context.Context, id storiface.ID) (fsutil.FsStat, er } func (st *Local) GenerateSingleVanillaProof(ctx context.Context, minerID abi.ActorID, si storiface.PostSectorChallenge, ppt abi.RegisteredPoStProof) ([]byte, error) { - sr := storage.SectorRef{ + sr := storiface.SectorRef{ ID: abi.SectorID{ Miner: minerID, Number: si.SectorNumber, diff --git a/storage/paths/mocks/store.go b/storage/paths/mocks/store.go index b1238c479..72be48323 100644 --- a/storage/paths/mocks/store.go +++ b/storage/paths/mocks/store.go @@ -11,7 +11,6 @@ import ( gomock "github.com/golang/mock/gomock" abi "github.com/filecoin-project/go-state-types/abi" - storage "github.com/filecoin-project/specs-storage/storage" fsutil "github.com/filecoin-project/lotus/storage/sealer/fsutil" storiface "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -41,7 +40,7 @@ func (m *MockStore) EXPECT() *MockStoreMockRecorder { } // AcquireSector mocks base method. -func (m *MockStore) AcquireSector(arg0 context.Context, arg1 storage.SectorRef, arg2, arg3 storiface.SectorFileType, arg4 storiface.PathType, arg5 storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) { +func (m *MockStore) AcquireSector(arg0 context.Context, arg1 storiface.SectorRef, arg2, arg3 storiface.SectorFileType, arg4 storiface.PathType, arg5 storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "AcquireSector", arg0, arg1, arg2, arg3, arg4, arg5) ret0, _ := ret[0].(storiface.SectorPaths) @@ -87,7 +86,7 @@ func (mr *MockStoreMockRecorder) GenerateSingleVanillaProof(arg0, arg1, arg2, ar } // MoveStorage mocks base method. -func (m *MockStore) MoveStorage(arg0 context.Context, arg1 storage.SectorRef, arg2 storiface.SectorFileType) error { +func (m *MockStore) MoveStorage(arg0 context.Context, arg1 storiface.SectorRef, arg2 storiface.SectorFileType) error { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "MoveStorage", arg0, arg1, arg2) ret0, _ := ret[0].(error) @@ -129,7 +128,7 @@ func (mr *MockStoreMockRecorder) RemoveCopies(arg0, arg1, arg2 interface{}) *gom } // Reserve mocks base method. -func (m *MockStore) Reserve(arg0 context.Context, arg1 storage.SectorRef, arg2 storiface.SectorFileType, arg3 storiface.SectorPaths, arg4 map[storiface.SectorFileType]int) (func(), error) { +func (m *MockStore) Reserve(arg0 context.Context, arg1 storiface.SectorRef, arg2 storiface.SectorFileType, arg3 storiface.SectorPaths, arg4 map[storiface.SectorFileType]int) (func(), error) { m.ctrl.T.Helper() ret := m.ctrl.Call(m, "Reserve", arg0, arg1, arg2, arg3, arg4) ret0, _ := ret[0].(func()) diff --git a/storage/paths/remote.go b/storage/paths/remote.go index d44c0b55e..8375b66d4 100644 --- a/storage/paths/remote.go +++ b/storage/paths/remote.go @@ -21,7 +21,6 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/fsutil" "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -90,7 +89,7 @@ func NewRemote(local Store, index SectorIndex, auth http.Header, fetchLimit int, } } -func (r *Remote) AcquireSector(ctx context.Context, s storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) { +func (r *Remote) AcquireSector(ctx context.Context, s storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, pathType storiface.PathType, op storiface.AcquireMode) (storiface.SectorPaths, storiface.SectorPaths, error) { if existing|allocate != existing^allocate { return storiface.SectorPaths{}, storiface.SectorPaths{}, xerrors.New("can't both find and allocate a sector") } @@ -354,7 +353,7 @@ func (r *Remote) checkAllocated(ctx context.Context, url string, spt abi.Registe } } -func (r *Remote) MoveStorage(ctx context.Context, s storage.SectorRef, types storiface.SectorFileType) error { +func (r *Remote) MoveStorage(ctx context.Context, s storiface.SectorRef, types storiface.SectorFileType) error { // Make sure we have the data local _, _, err := r.AcquireSector(ctx, s, types, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove) if err != nil { @@ -529,7 +528,7 @@ func (r *Remote) readRemote(ctx context.Context, url string, offset, size abi.Pa // CheckIsUnsealed checks if we have an unsealed piece at the given offset in an already unsealed sector file for the given piece // either locally or on any of the workers. // Returns true if we have the unsealed piece, false otherwise. -func (r *Remote) CheckIsUnsealed(ctx context.Context, s storage.SectorRef, offset, size abi.PaddedPieceSize) (bool, error) { +func (r *Remote) CheckIsUnsealed(ctx context.Context, s storiface.SectorRef, offset, size abi.PaddedPieceSize) (bool, error) { ft := storiface.FTUnsealed paths, _, err := r.local.AcquireSector(ctx, s, ft, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove) @@ -616,7 +615,7 @@ func (r *Remote) CheckIsUnsealed(ctx context.Context, s storage.SectorRef, offse // 1. no worker(local worker included) has an unsealed file for the given sector OR // 2. no worker(local worker included) has the unsealed piece in their unsealed sector file. // Will return a nil reader and a nil error in such a case. -func (r *Remote) Reader(ctx context.Context, s storage.SectorRef, offset, size abi.PaddedPieceSize) (func(startOffsetAligned storiface.PaddedByteIndex) (io.ReadCloser, error), error) { +func (r *Remote) Reader(ctx context.Context, s storiface.SectorRef, offset, size abi.PaddedPieceSize) (func(startOffsetAligned storiface.PaddedByteIndex) (io.ReadCloser, error), error) { ft := storiface.FTUnsealed // check if we have the unsealed sector file locally @@ -762,7 +761,7 @@ func (r *Remote) Reader(ctx context.Context, s storage.SectorRef, offset, size a return nil, nil } -func (r *Remote) Reserve(ctx context.Context, sid storage.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) { +func (r *Remote) Reserve(ctx context.Context, sid storiface.SectorRef, ft storiface.SectorFileType, storageIDs storiface.SectorPaths, overheadTab map[storiface.SectorFileType]int) (func(), error) { log.Warnf("reserve called on remote store, sectorID: %v", sid.ID) return func() { diff --git a/storage/paths/remote_test.go b/storage/paths/remote_test.go index 237501b7a..d59b2c270 100644 --- a/storage/paths/remote_test.go +++ b/storage/paths/remote_test.go @@ -21,7 +21,6 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/storage/paths" @@ -117,7 +116,7 @@ func TestMoveShared(t *testing.T) { // add a sealed replica file to the sealing (non-shared) path - s1ref := storage.SectorRef{ + s1ref := storiface.SectorRef{ ID: abi.SectorID{ Miner: 12, Number: 1, @@ -162,7 +161,7 @@ func TestReader(t *testing.T) { ft := storiface.FTUnsealed - sectorRef := storage.SectorRef{ + sectorRef := storiface.SectorRef{ ID: abi.SectorID{ Miner: 123, Number: 123, @@ -519,7 +518,7 @@ func TestCheckIsUnsealed(t *testing.T) { ft := storiface.FTUnsealed emptyPartialFile := &partialfile.PartialFile{} - sectorRef := storage.SectorRef{ + sectorRef := storiface.SectorRef{ ID: abi.SectorID{ Miner: 123, Number: 123, @@ -789,7 +788,7 @@ func TestCheckIsUnsealed(t *testing.T) { } } -func mockSectorAcquire(l *mocks.MockStore, sectorRef storage.SectorRef, pfPath string, err error) { +func mockSectorAcquire(l *mocks.MockStore, sectorRef storiface.SectorRef, pfPath string, err error) { l.EXPECT().AcquireSector(gomock.Any(), sectorRef, storiface.FTUnsealed, storiface.FTNone, storiface.PathStorage, storiface.AcquireMove).Return(storiface.SectorPaths{ Unsealed: pfPath, diff --git a/storage/pipeline/cbor_gen.go b/storage/pipeline/cbor_gen.go index d039d802f..2fb8c445c 100644 --- a/storage/pipeline/cbor_gen.go +++ b/storage/pipeline/cbor_gen.go @@ -312,7 +312,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } } - // t.PreCommit1Out (storage.PreCommit1Out) (slice) + // t.PreCommit1Out (storiface.PreCommit1Out) (slice) if len("PreCommit1Out") > cbg.MaxLength { return xerrors.Errorf("Value in field \"PreCommit1Out\" was too long") } @@ -659,7 +659,7 @@ func (t *SectorInfo) MarshalCBOR(w io.Writer) error { } } - // t.ReplicaUpdateProof (storage.ReplicaUpdateProof) (slice) + // t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice) if len("ReplicaUpdateProof") > cbg.MaxLength { return xerrors.Errorf("Value in field \"ReplicaUpdateProof\" was too long") } @@ -1038,7 +1038,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { t.TicketEpoch = abi.ChainEpoch(extraI) } - // t.PreCommit1Out (storage.PreCommit1Out) (slice) + // t.PreCommit1Out (storiface.PreCommit1Out) (slice) case "PreCommit1Out": maj, extra, err = cr.ReadHeader() @@ -1386,7 +1386,7 @@ func (t *SectorInfo) UnmarshalCBOR(r io.Reader) (err error) { } } - // t.ReplicaUpdateProof (storage.ReplicaUpdateProof) (slice) + // t.ReplicaUpdateProof (storiface.ReplicaUpdateProof) (slice) case "ReplicaUpdateProof": maj, extra, err = cr.ReadHeader() diff --git a/storage/pipeline/fsm_events.go b/storage/pipeline/fsm_events.go index f8b721f1e..eb1087151 100644 --- a/storage/pipeline/fsm_events.go +++ b/storage/pipeline/fsm_events.go @@ -9,9 +9,9 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/builtin/v8/miner" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) type mutator interface { @@ -135,7 +135,7 @@ type SectorOldTicket struct{} func (evt SectorOldTicket) apply(*SectorInfo) {} type SectorPreCommit1 struct { - PreCommit1Out storage.PreCommit1Out + PreCommit1Out storiface.PreCommit1Out } func (evt SectorPreCommit1) apply(state *SectorInfo) { @@ -316,7 +316,7 @@ func (evt SectorStartCCUpdate) apply(state *SectorInfo) { } type SectorReplicaUpdate struct { - Out storage.ReplicaUpdateOut + Out storiface.ReplicaUpdateOut } func (evt SectorReplicaUpdate) apply(state *SectorInfo) { @@ -325,7 +325,7 @@ func (evt SectorReplicaUpdate) apply(state *SectorInfo) { } type SectorProveReplicaUpdate struct { - Proof storage.ReplicaUpdateProof + Proof storiface.ReplicaUpdateProof } func (evt SectorProveReplicaUpdate) apply(state *SectorInfo) { diff --git a/storage/pipeline/garbage.go b/storage/pipeline/garbage.go index d429b5b43..6c4c20743 100644 --- a/storage/pipeline/garbage.go +++ b/storage/pipeline/garbage.go @@ -5,10 +5,10 @@ import ( "golang.org/x/xerrors" - "github.com/filecoin-project/specs-storage/storage" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) -func (m *Sealing) PledgeSector(ctx context.Context) (storage.SectorRef, error) { +func (m *Sealing) PledgeSector(ctx context.Context) (storiface.SectorRef, error) { m.startupWait.Wait() m.inputLk.Lock() @@ -16,23 +16,23 @@ func (m *Sealing) PledgeSector(ctx context.Context) (storage.SectorRef, error) { cfg, err := m.getConfig() if err != nil { - return storage.SectorRef{}, xerrors.Errorf("getting config: %w", err) + return storiface.SectorRef{}, xerrors.Errorf("getting config: %w", err) } if cfg.MaxSealingSectors > 0 { if m.stats.curSealing() >= cfg.MaxSealingSectors { - return storage.SectorRef{}, xerrors.Errorf("too many sectors sealing (curSealing: %d, max: %d)", m.stats.curSealing(), cfg.MaxSealingSectors) + return storiface.SectorRef{}, xerrors.Errorf("too many sectors sealing (curSealing: %d, max: %d)", m.stats.curSealing(), cfg.MaxSealingSectors) } } spt, err := m.currentSealProof(ctx) if err != nil { - return storage.SectorRef{}, xerrors.Errorf("getting seal proof type: %w", err) + return storiface.SectorRef{}, xerrors.Errorf("getting seal proof type: %w", err) } sid, err := m.createSector(ctx, cfg, spt) if err != nil { - return storage.SectorRef{}, err + return storiface.SectorRef{}, err } log.Infof("Creating CC sector %d", sid) diff --git a/storage/pipeline/input.go b/storage/pipeline/input.go index 87270af39..d59630e84 100644 --- a/storage/pipeline/input.go +++ b/storage/pipeline/input.go @@ -13,7 +13,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-statemachine" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -23,6 +22,7 @@ import ( "github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) func (m *Sealing) handleWaitDeals(ctx statemachine.Context, sector SectorInfo) error { @@ -274,7 +274,7 @@ func (m *Sealing) handleAddPieceFailed(ctx statemachine.Context, sector SectorIn return ctx.Send(SectorRetryWaitDeals{}) } -func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, data storage.Data, deal api.PieceDealInfo) (api.SectorOffset, error) { +func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, data storiface.Data, deal api.PieceDealInfo) (api.SectorOffset, error) { log.Infof("Adding piece for deal %d (publish msg: %s)", deal.DealID, deal.PublishCid) if (padreader.PaddedSize(uint64(size))) != size { return api.SectorOffset{}, xerrors.Errorf("cannot allocate unpadded piece") @@ -341,7 +341,7 @@ func (m *Sealing) SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPiec } // called with m.inputLk; transfers the lock to another goroutine! -func (m *Sealing) addPendingPiece(ctx context.Context, size abi.UnpaddedPieceSize, data storage.Data, deal api.PieceDealInfo, sp abi.RegisteredSealProof) *pendingPiece { +func (m *Sealing) addPendingPiece(ctx context.Context, size abi.UnpaddedPieceSize, data storiface.Data, deal api.PieceDealInfo, sp abi.RegisteredSealProof) *pendingPiece { doneCh := make(chan struct{}) pp := &pendingPiece{ doneCh: doneCh, diff --git a/storage/pipeline/sealing.go b/storage/pipeline/sealing.go index 402e46250..ac8316740 100644 --- a/storage/pipeline/sealing.go +++ b/storage/pipeline/sealing.go @@ -19,7 +19,6 @@ import ( "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-statemachine" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner" @@ -29,6 +28,7 @@ import ( "github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) const SectorStorePrefix = "/sectors" @@ -144,7 +144,7 @@ type pendingPiece struct { size abi.UnpaddedPieceSize deal api.PieceDealInfo - data storage.Data + data storiface.Data assigned bool // assigned to a sector? accepted func(abi.SectorNumber, abi.UnpaddedPieceSize, error) @@ -262,8 +262,8 @@ func (m *Sealing) currentSealProof(ctx context.Context) (abi.RegisteredSealProof return lminer.PreferredSealProofTypeFromWindowPoStType(ver, mi.WindowPoStProofType) } -func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storage.SectorRef { - return storage.SectorRef{ +func (m *Sealing) minerSector(spt abi.RegisteredSealProof, num abi.SectorNumber) storiface.SectorRef { + return storiface.SectorRef{ ID: m.minerSectorID(num), ProofType: spt, } diff --git a/storage/pipeline/states_sealing.go b/storage/pipeline/states_sealing.go index ae0d31017..cc248a078 100644 --- a/storage/pipeline/states_sealing.go +++ b/storage/pipeline/states_sealing.go @@ -17,7 +17,6 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-statemachine" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -25,6 +24,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) var DealSectorPriority = 1024 @@ -84,7 +84,7 @@ func (m *Sealing) handlePacking(ctx statemachine.Context, sector SectorInfo) err return ctx.Send(SectorPacked{FillerPieces: fillerPieces}) } -func (m *Sealing) padSector(ctx context.Context, sectorID storage.SectorRef, existingPieceSizes []abi.UnpaddedPieceSize, sizes ...abi.UnpaddedPieceSize) ([]abi.PieceInfo, error) { +func (m *Sealing) padSector(ctx context.Context, sectorID storiface.SectorRef, existingPieceSizes []abi.UnpaddedPieceSize, sizes ...abi.UnpaddedPieceSize) ([]abi.PieceInfo, error) { if len(sizes) == 0 { return nil, nil } @@ -562,7 +562,7 @@ func (m *Sealing) handleCommitting(ctx statemachine.Context, sector SectorInfo) return ctx.Send(SectorCommitFailed{xerrors.Errorf("sector had nil commR or commD")}) } - cids := storage.SectorCids{ + cids := storiface.SectorCids{ Unsealed: *sector.CommD, Sealed: *sector.CommR, } diff --git a/storage/pipeline/types.go b/storage/pipeline/types.go index aa0ee8c3c..105a1a64a 100644 --- a/storage/pipeline/types.go +++ b/storage/pipeline/types.go @@ -8,12 +8,12 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/builtin/v8/miner" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/storage/pipeline/sealiface" "github.com/filecoin-project/lotus/storage/sealer" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) //go:generate go run github.com/golang/mock/mockgen -destination=mocks/statemachine.go -package=mocks . Context @@ -68,7 +68,7 @@ type SectorInfo struct { // PreCommit1 TicketValue abi.SealRandomness TicketEpoch abi.ChainEpoch - PreCommit1Out storage.PreCommit1Out + PreCommit1Out storiface.PreCommit1Out // PreCommit2 CommD *cid.Cid @@ -95,7 +95,7 @@ type SectorInfo struct { CCPieces []Piece UpdateSealed *cid.Cid UpdateUnsealed *cid.Cid - ReplicaUpdateProof storage.ReplicaUpdateProof + ReplicaUpdateProof storiface.ReplicaUpdateProof ReplicaUpdateMessage *cid.Cid // Faults @@ -164,8 +164,8 @@ func (t *SectorInfo) sealingCtx(ctx context.Context) context.Context { // Returns list of offset/length tuples of sector data ranges which clients // requested to keep unsealed -func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool) []storage.Range { - var out []storage.Range +func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool) []storiface.Range { + var out []storiface.Range var at abi.UnpaddedPieceSize for _, piece := range pieces { @@ -182,7 +182,7 @@ func (t *SectorInfo) keepUnsealedRanges(pieces []Piece, invert, alwaysKeep bool) continue } - out = append(out, storage.Range{ + out = append(out, storiface.Range{ Offset: at - psize, Size: psize, }) diff --git a/storage/sealer/faults.go b/storage/sealer/faults.go index 6100dbb87..e05bbb7b8 100644 --- a/storage/sealer/faults.go +++ b/storage/sealer/faults.go @@ -11,7 +11,6 @@ import ( ffi "github.com/filecoin-project/filecoin-ffi" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/storiface" ) @@ -20,11 +19,11 @@ var PostCheckTimeout = 160 * time.Second // FaultTracker TODO: Track things more actively type FaultTracker interface { - CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) + CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) } // CheckProvable returns unprovable sectors -func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) { +func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -61,7 +60,7 @@ func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, return nil, ctx.Err() } - go func(sector storage.SectorRef) { + go func(sector storiface.SectorRef) { defer wg.Done() defer func() { <-throttle diff --git a/storage/sealer/ffiwrapper/basicfs/fs.go b/storage/sealer/ffiwrapper/basicfs/fs.go index 5cd48bb82..7a9f70d59 100644 --- a/storage/sealer/ffiwrapper/basicfs/fs.go +++ b/storage/sealer/ffiwrapper/basicfs/fs.go @@ -7,7 +7,6 @@ import ( "sync" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/storiface" ) @@ -24,7 +23,7 @@ type Provider struct { waitSector map[sectorFile]chan struct{} } -func (b *Provider) AcquireSector(ctx context.Context, id storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) { +func (b *Provider) AcquireSector(ctx context.Context, id storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) { if err := os.Mkdir(filepath.Join(b.Root, storiface.FTUnsealed.String()), 0755); err != nil && !os.IsExist(err) { // nolint return storiface.SectorPaths{}, nil, err } diff --git a/storage/sealer/ffiwrapper/sealer_cgo.go b/storage/sealer/ffiwrapper/sealer_cgo.go index e2c2d03af..0f89a6e8c 100644 --- a/storage/sealer/ffiwrapper/sealer_cgo.go +++ b/storage/sealer/ffiwrapper/sealer_cgo.go @@ -26,7 +26,6 @@ import ( commcid "github.com/filecoin-project/go-fil-commcid" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/lib/nullreader" nr "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" @@ -47,13 +46,13 @@ func New(sectors SectorProvider) (*Sealer, error) { return sb, nil } -func (sb *Sealer) NewSector(ctx context.Context, sector storage.SectorRef) error { +func (sb *Sealer) NewSector(ctx context.Context, sector storiface.SectorRef) error { // TODO: Allocate the sector here instead of in addpiece return nil } -func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) { +func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) { pieceData = io.LimitReader(io.MultiReader( pieceData, nullreader.Reader{}, @@ -173,7 +172,7 @@ func (sb *Sealer) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, }, nil } -func (sb *Sealer) AddPiece(ctx context.Context, sector storage.SectorRef, existingPieceSizes []abi.UnpaddedPieceSize, pieceSize abi.UnpaddedPieceSize, file storage.Data) (abi.PieceInfo, error) { +func (sb *Sealer) AddPiece(ctx context.Context, sector storiface.SectorRef, existingPieceSizes []abi.UnpaddedPieceSize, pieceSize abi.UnpaddedPieceSize, file storiface.Data) (abi.PieceInfo, error) { // TODO: allow tuning those: chunk := abi.PaddedPieceSize(4 << 20) parallel := runtime.NumCPU() @@ -377,7 +376,7 @@ func (sb *Sealer) pieceCid(spt abi.RegisteredSealProof, in []byte) (cid.Cid, err return pieceCID, werr() } -func (sb *Sealer) tryDecodeUpdatedReplica(ctx context.Context, sector storage.SectorRef, commD cid.Cid, unsealedPath string, randomness abi.SealRandomness) (bool, error) { +func (sb *Sealer) tryDecodeUpdatedReplica(ctx context.Context, sector storiface.SectorRef, commD cid.Cid, unsealedPath string, randomness abi.SealRandomness) (bool, error) { replicaPath, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathStorage) if xerrors.Is(err, storiface.ErrSectorNotFound) { return false, nil @@ -400,7 +399,7 @@ func (sb *Sealer) tryDecodeUpdatedReplica(ctx context.Context, sector storage.Se return true, ffi.SectorUpdate.DecodeFrom(updateProof, unsealedPath, replicaPath.Update, sealedPaths.Sealed, sealedPaths.Cache, commD) } -func (sb *Sealer) AcquireSectorKeyOrRegenerate(ctx context.Context, sector storage.SectorRef, randomness abi.SealRandomness) (storiface.SectorPaths, func(), error) { +func (sb *Sealer) AcquireSectorKeyOrRegenerate(ctx context.Context, sector storiface.SectorRef, randomness abi.SealRandomness) (storiface.SectorPaths, func(), error) { paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, storiface.FTNone, storiface.PathStorage) if err == nil { return paths, done, err @@ -429,7 +428,7 @@ func (sb *Sealer) AcquireSectorKeyOrRegenerate(ctx context.Context, sector stora return sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, storiface.FTNone, storiface.PathStorage) } -func (sb *Sealer) UnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error { +func (sb *Sealer) UnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error { ssize, err := sector.ProofType.SectorSize() if err != nil { return err @@ -605,7 +604,7 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector storage.SectorRef, off return nil } -func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) { +func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) { path, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed, storiface.FTNone, storiface.PathStorage) if err != nil { return false, xerrors.Errorf("acquire unsealed sector path: %w", err) @@ -661,7 +660,7 @@ func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector storag return true, nil } -func (sb *Sealer) RegenerateSectorKey(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) error { +func (sb *Sealer) RegenerateSectorKey(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) error { paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTCache, storiface.FTSealed, storiface.PathSealing) if err != nil { return xerrors.Errorf("acquiring sector paths: %w", err) @@ -706,7 +705,7 @@ func (sb *Sealer) RegenerateSectorKey(ctx context.Context, sector storage.Sector return nil } -func (sb *Sealer) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage.PreCommit1Out, err error) { +func (sb *Sealer) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storiface.PreCommit1Out, err error) { paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed, storiface.FTSealed|storiface.FTCache, storiface.PathSealing) if err != nil { return nil, xerrors.Errorf("acquiring sector paths: %w", err) @@ -777,26 +776,26 @@ func (sb *Sealer) SealPreCommit1(ctx context.Context, sector storage.SectorRef, var PC2CheckRounds = 3 -func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.PreCommit1Out) (storage.SectorCids, error) { +func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.PreCommit1Out) (storiface.SectorCids, error) { paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, 0, storiface.PathSealing) if err != nil { - return storage.SectorCids{}, xerrors.Errorf("acquiring sector paths: %w", err) + return storiface.SectorCids{}, xerrors.Errorf("acquiring sector paths: %w", err) } defer done() sealedCID, unsealedCID, err := ffi.SealPreCommitPhase2(phase1Out, paths.Cache, paths.Sealed) if err != nil { - return storage.SectorCids{}, xerrors.Errorf("presealing sector %d (%s): %w", sector.ID.Number, paths.Unsealed, err) + return storiface.SectorCids{}, xerrors.Errorf("presealing sector %d (%s): %w", sector.ID.Number, paths.Unsealed, err) } ssize, err := sector.ProofType.SectorSize() if err != nil { - return storage.SectorCids{}, xerrors.Errorf("get ssize: %w", err) + return storiface.SectorCids{}, xerrors.Errorf("get ssize: %w", err) } p1odec := map[string]interface{}{} if err := json.Unmarshal(phase1Out, &p1odec); err != nil { - return storage.SectorCids{}, xerrors.Errorf("unmarshaling pc1 output: %w", err) + return storiface.SectorCids{}, xerrors.Errorf("unmarshaling pc1 output: %w", err) } var ticket abi.SealRandomness @@ -805,7 +804,7 @@ func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storage.SectorRef, if found { ticket, err = base64.StdEncoding.DecodeString(ti.(string)) if err != nil { - return storage.SectorCids{}, xerrors.Errorf("decoding ticket: %w", err) + return storiface.SectorCids{}, xerrors.Errorf("decoding ticket: %w", err) } for i := 0; i < PC2CheckRounds; i++ { @@ -828,18 +827,18 @@ func (sb *Sealer) SealPreCommit2(ctx context.Context, sector storage.SectorRef, log.Warn("checking PreCommit failed: ", err) log.Warnf("num:%d tkt:%v seed:%v sealedCID:%v, unsealedCID:%v", sector.ID.Number, ticket, sd[:], sealedCID, unsealedCID) - return storage.SectorCids{}, xerrors.Errorf("checking PreCommit failed: %w", err) + return storiface.SectorCids{}, xerrors.Errorf("checking PreCommit failed: %w", err) } } } - return storage.SectorCids{ + return storiface.SectorCids{ Unsealed: unsealedCID, Sealed: sealedCID, }, nil } -func (sb *Sealer) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storage.Commit1Out, error) { +func (sb *Sealer) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.Commit1Out, error) { paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache, 0, storiface.PathSealing) if err != nil { return nil, xerrors.Errorf("acquire sector paths: %w", err) @@ -866,12 +865,12 @@ func (sb *Sealer) SealCommit1(ctx context.Context, sector storage.SectorRef, tic return output, nil } -func (sb *Sealer) SealCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.Commit1Out) (storage.Proof, error) { +func (sb *Sealer) SealCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.Commit1Out) (storiface.Proof, error) { return ffi.SealCommitPhase2(phase1Out, sector.ID.Number, sector.ID.Miner) } -func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storage.ReplicaUpdateOut, error) { - empty := storage.ReplicaUpdateOut{} +func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.ReplicaUpdateOut, error) { + empty := storiface.ReplicaUpdateOut{} paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing) if err != nil { return empty, xerrors.Errorf("failed to acquire sector paths: %w", err) @@ -917,10 +916,10 @@ func (sb *Sealer) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p if err != nil { return empty, xerrors.Errorf("failed to update replica %d with new deal data: %w", sector.ID.Number, err) } - return storage.ReplicaUpdateOut{NewSealed: sealed, NewUnsealed: unsealed}, nil + return storiface.ReplicaUpdateOut{NewSealed: sealed, NewUnsealed: unsealed}, nil } -func (sb *Sealer) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storage.ReplicaVanillaProofs, error) { +func (sb *Sealer) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.ReplicaVanillaProofs, error) { paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTSealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTNone, storiface.PathSealing) if err != nil { return nil, xerrors.Errorf("failed to acquire sector paths: %w", err) @@ -936,12 +935,12 @@ func (sb *Sealer) ProveReplicaUpdate1(ctx context.Context, sector storage.Sector return vanillaProofs, nil } -func (sb *Sealer) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storage.ReplicaUpdateProof, error) { +func (sb *Sealer) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.ReplicaUpdateProof, error) { updateProofType := abi.SealProofInfos[sector.ProofType].UpdateProof return ffi.SectorUpdate.GenerateUpdateProofWithVanilla(updateProofType, sectorKey, newSealed, newUnsealed, vanillaProofs) } -func (sb *Sealer) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) error { +func (sb *Sealer) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) error { paths, done, err := sb.sectors.AcquireSector(ctx, sector, storiface.FTUnsealed|storiface.FTCache|storiface.FTUpdate|storiface.FTUpdateCache, storiface.FTSealed, storiface.PathSealing) defer done() if err != nil { @@ -968,11 +967,11 @@ func (sb *Sealer) GenerateSectorKeyFromData(ctx context.Context, sector storage. return ffi.SectorUpdate.RemoveData(updateProofType, paths.Sealed, paths.Cache, paths.Update, paths.UpdateCache, paths.Unsealed, commD) } -func (sb *Sealer) ReleaseSealed(ctx context.Context, sector storage.SectorRef) error { +func (sb *Sealer) ReleaseSealed(ctx context.Context, sector storiface.SectorRef) error { return xerrors.Errorf("not supported at this layer") } -func (sb *Sealer) freeUnsealed(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { +func (sb *Sealer) freeUnsealed(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { ssize, err := sector.ProofType.SectorSize() if err != nil { return err @@ -1040,7 +1039,7 @@ func (sb *Sealer) freeUnsealed(ctx context.Context, sector storage.SectorRef, ke return nil } -func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { +func (sb *Sealer) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { ssize, err := sector.ProofType.SectorSize() if err != nil { return err @@ -1059,7 +1058,7 @@ func (sb *Sealer) FinalizeSector(ctx context.Context, sector storage.SectorRef, return ffi.ClearCache(uint64(ssize), paths.Cache) } -func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { +func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { ssize, err := sector.ProofType.SectorSize() if err != nil { return err @@ -1096,7 +1095,7 @@ func (sb *Sealer) FinalizeReplicaUpdate(ctx context.Context, sector storage.Sect return nil } -func (sb *Sealer) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error { +func (sb *Sealer) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error { // This call is meant to mark storage as 'freeable'. Given that unsealing is // very expensive, we don't remove data as soon as we can - instead we only // do that when we don't have free space for data that really needs it @@ -1106,15 +1105,15 @@ func (sb *Sealer) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, return xerrors.Errorf("not supported at this layer") } -func (sb *Sealer) ReleaseReplicaUpgrade(ctx context.Context, sector storage.SectorRef) error { +func (sb *Sealer) ReleaseReplicaUpgrade(ctx context.Context, sector storiface.SectorRef) error { return xerrors.Errorf("not supported at this layer") } -func (sb *Sealer) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef) error { +func (sb *Sealer) ReleaseSectorKey(ctx context.Context, sector storiface.SectorRef) error { return xerrors.Errorf("not supported at this layer") } -func (sb *Sealer) Remove(ctx context.Context, sector storage.SectorRef) error { +func (sb *Sealer) Remove(ctx context.Context, sector storiface.SectorRef) error { return xerrors.Errorf("not supported at this layer") // happens in localworker } diff --git a/storage/sealer/ffiwrapper/sealer_test.go b/storage/sealer/ffiwrapper/sealer_test.go index f539209f9..829190015 100644 --- a/storage/sealer/ffiwrapper/sealer_test.go +++ b/storage/sealer/ffiwrapper/sealer_test.go @@ -26,7 +26,6 @@ import ( "github.com/filecoin-project/go-paramfetch" "github.com/filecoin-project/go-state-types/abi" prooftypes "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/storage/pipeline/lib/nullreader" @@ -44,8 +43,8 @@ var sectorSize, _ = sealProofType.SectorSize() var sealRand = abi.SealRandomness{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 1, 2} type seal struct { - ref storage.SectorRef - cids storage.SectorCids + ref storiface.SectorRef + cids storiface.SectorCids pi abi.PieceInfo ticket abi.SealRandomness } @@ -57,7 +56,7 @@ func data(sn abi.SectorNumber, dlen abi.UnpaddedPieceSize) io.Reader { ) } -func (s *seal) precommit(t *testing.T, sb *Sealer, id storage.SectorRef, done func()) { +func (s *seal) precommit(t *testing.T, sb *Sealer, id storiface.SectorRef, done func()) { defer done() dlen := abi.PaddedPieceSize(sectorSize).Unpadded() @@ -86,7 +85,7 @@ func (s *seal) precommit(t *testing.T, sb *Sealer, id storage.SectorRef, done fu var seed = abi.InteractiveSealRandomness{0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9} -func (s *seal) commit(t *testing.T, sb *Sealer, done func()) storage.Proof { +func (s *seal) commit(t *testing.T, sb *Sealer, done func()) storiface.Proof { defer done() pc1, err := sb.SealCommit1(context.TODO(), s.ref, s.ticket, seed, []abi.PieceInfo{s.pi}, s.cids) @@ -122,7 +121,7 @@ func (s *seal) commit(t *testing.T, sb *Sealer, done func()) storage.Proof { return proof } -func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storage.SectorRef, done func()) { +func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si storiface.SectorRef, done func()) { defer done() var b bytes.Buffer @@ -225,7 +224,7 @@ func post(t *testing.T, sealer *Sealer, skipped []abi.SectorID, seals ...seal) { } } -func corrupt(t *testing.T, sealer *Sealer, id storage.SectorRef) { +func corrupt(t *testing.T, sealer *Sealer, id storiface.SectorRef) { paths, done, err := sealer.sectors.AcquireSector(context.Background(), id, storiface.FTSealed, 0, storiface.PathStorage) require.NoError(t, err) defer done() @@ -306,7 +305,7 @@ func TestSealAndVerify(t *testing.T) { } }) - si := storage.SectorRef{ + si := storiface.SectorRef{ ID: abi.SectorID{Miner: miner, Number: 1}, ProofType: sealProofType, } @@ -379,7 +378,7 @@ func TestSealPoStNoCommit(t *testing.T) { } }) - si := storage.SectorRef{ + si := storiface.SectorRef{ ID: abi.SectorID{Miner: miner, Number: 1}, ProofType: sealProofType, } @@ -441,15 +440,15 @@ func TestSealAndVerify3(t *testing.T) { var wg sync.WaitGroup - si1 := storage.SectorRef{ + si1 := storiface.SectorRef{ ID: abi.SectorID{Miner: miner, Number: 1}, ProofType: sealProofType, } - si2 := storage.SectorRef{ + si2 := storiface.SectorRef{ ID: abi.SectorID{Miner: miner, Number: 2}, ProofType: sealProofType, } - si3 := storage.SectorRef{ + si3 := storiface.SectorRef{ ID: abi.SectorID{Miner: miner, Number: 3}, ProofType: sealProofType, } @@ -529,7 +528,7 @@ func TestSealAndVerifyAggregate(t *testing.T) { toAggregate := make([][]byte, numAgg) for i := 0; i < numAgg; i++ { - si := storage.SectorRef{ + si := storiface.SectorRef{ ID: abi.SectorID{Miner: miner, Number: abi.SectorNumber(i + 1)}, ProofType: sealProofType, } @@ -763,7 +762,7 @@ func TestAddPiece512M(t *testing.T) { r := rand.New(rand.NewSource(0x7e5)) - c, err := sb.AddPiece(context.TODO(), storage.SectorRef{ + c, err := sb.AddPiece(context.TODO(), storiface.SectorRef{ ID: abi.SectorID{ Miner: miner, Number: 0, @@ -806,7 +805,7 @@ func BenchmarkAddPiece512M(b *testing.B) { b.Cleanup(cleanup) for i := 0; i < b.N; i++ { - c, err := sb.AddPiece(context.TODO(), storage.SectorRef{ + c, err := sb.AddPiece(context.TODO(), storiface.SectorRef{ ID: abi.SectorID{ Miner: miner, Number: abi.SectorNumber(i), @@ -849,7 +848,7 @@ func TestAddPiece512MPadded(t *testing.T) { r := rand.New(rand.NewSource(0x7e5)) - c, err := sb.AddPiece(context.TODO(), storage.SectorRef{ + c, err := sb.AddPiece(context.TODO(), storiface.SectorRef{ ID: abi.SectorID{ Miner: miner, Number: 0, @@ -917,7 +916,7 @@ func TestMulticoreSDR(t *testing.T) { } }) - si := storage.SectorRef{ + si := storiface.SectorRef{ ID: abi.SectorID{Miner: miner, Number: 1}, ProofType: sealProofType, } diff --git a/storage/sealer/ffiwrapper/types.go b/storage/sealer/ffiwrapper/types.go index fcf71ab82..b32a3cc82 100644 --- a/storage/sealer/ffiwrapper/types.go +++ b/storage/sealer/ffiwrapper/types.go @@ -8,7 +8,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper/basicfs" "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -20,16 +19,16 @@ type Validator interface { } type StorageSealer interface { - storage.Sealer - storage.Storage + storiface.Sealer + storiface.Storage } type Storage interface { - storage.Prover + storiface.Prover StorageSealer - UnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error - ReadPiece(ctx context.Context, writer io.Writer, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) + UnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error + ReadPiece(ctx context.Context, writer io.Writer, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) } type Verifier interface { @@ -52,7 +51,7 @@ type Prover interface { type SectorProvider interface { // * returns storiface.ErrSectorNotFound if a requested existing sector doesn't exist // * returns an error when allocate is set, and existing isn't, and the sector exists - AcquireSector(ctx context.Context, id storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) + AcquireSector(ctx context.Context, id storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, ptype storiface.PathType) (storiface.SectorPaths, func(), error) } var _ SectorProvider = &basicfs.Provider{} diff --git a/storage/sealer/ffiwrapper/verifier_cgo.go b/storage/sealer/ffiwrapper/verifier_cgo.go index 2c21ebce6..2ff5bc91a 100644 --- a/storage/sealer/ffiwrapper/verifier_cgo.go +++ b/storage/sealer/ffiwrapper/verifier_cgo.go @@ -12,7 +12,6 @@ import ( ffi "github.com/filecoin-project/filecoin-ffi" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/storiface" ) @@ -76,7 +75,7 @@ func (sb *Sealer) pubExtendedSectorToPriv(ctx context.Context, mid abi.ActorID, continue } - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{Miner: mid, Number: s.SectorNumber}, ProofType: s.SealProof, } diff --git a/storage/sealer/manager.go b/storage/sealer/manager.go index cbfcfec79..d1908d9f7 100644 --- a/storage/sealer/manager.go +++ b/storage/sealer/manager.go @@ -17,7 +17,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-statestore" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" @@ -47,7 +46,7 @@ type Worker interface { type SectorManager interface { ffiwrapper.StorageSealer - storage.Prover + storiface.Prover storiface.WorkerReturn FaultTracker } @@ -65,7 +64,7 @@ type Manager struct { windowPoStSched *poStScheduler winningPoStSched *poStScheduler - localProver storage.Prover + localProver storiface.Prover workLk sync.Mutex work *statestore.StateStore @@ -81,7 +80,7 @@ type Manager struct { waitRes map[WorkID]chan struct{} } -var _ storage.Prover = &Manager{} +var _ storiface.Prover = &Manager{} type result struct { r interface{} @@ -267,7 +266,7 @@ func schedNop(context.Context, Worker) error { return nil } -func (m *Manager) schedFetch(sector storage.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) func(context.Context, Worker) error { +func (m *Manager) schedFetch(sector storiface.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) func(context.Context, Worker) error { return func(ctx context.Context, worker Worker) error { _, err := m.waitSimpleCall(ctx)(worker.Fetch(ctx, sector, ft, ptype, am)) return err @@ -278,7 +277,7 @@ func (m *Manager) schedFetch(sector storage.SectorRef, ft storiface.SectorFileTy // It will schedule the Unsealing task on a worker that either already has the sealed sector files or has space in // one of it's sealing scratch spaces to store them after fetching them from another worker. // If the chosen worker already has the Unsealed sector file, we will NOT Unseal the sealed sector file again. -func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed *cid.Cid) error { +func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed *cid.Cid) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -335,19 +334,19 @@ func (m *Manager) SectorsUnsealPiece(ctx context.Context, sector storage.SectorR return nil } -func (m *Manager) NewSector(ctx context.Context, sector storage.SectorRef) error { +func (m *Manager) NewSector(ctx context.Context, sector storiface.SectorRef) error { log.Warnf("stub NewSector") return nil } -func (m *Manager) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) { +func (m *Manager) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() selector := newTaskSelector() var out abi.PieceInfo - err := m.sched.Schedule(ctx, storage.NoSectorRef, sealtasks.TTDataCid, selector, schedNop, func(ctx context.Context, w Worker) error { + err := m.sched.Schedule(ctx, storiface.NoSectorRef, sealtasks.TTDataCid, selector, schedNop, func(ctx context.Context, w Worker) error { p, err := m.waitSimpleCall(ctx)(w.DataCid(ctx, pieceSize, pieceData)) if err != nil { return err @@ -361,7 +360,7 @@ func (m *Manager) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, return out, err } -func (m *Manager) AddPiece(ctx context.Context, sector storage.SectorRef, existingPieces []abi.UnpaddedPieceSize, sz abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) { +func (m *Manager) AddPiece(ctx context.Context, sector storiface.SectorRef, existingPieces []abi.UnpaddedPieceSize, sz abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -392,7 +391,7 @@ func (m *Manager) AddPiece(ctx context.Context, sector storage.SectorRef, existi return out, err } -func (m *Manager) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage.PreCommit1Out, err error) { +func (m *Manager) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storiface.PreCommit1Out, err error) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -410,7 +409,7 @@ func (m *Manager) SealPreCommit1(ctx context.Context, sector storage.SectorRef, return } if p != nil { - out = p.(storage.PreCommit1Out) + out = p.(storiface.PreCommit1Out) } } @@ -443,13 +442,13 @@ func (m *Manager) SealPreCommit1(ctx context.Context, sector storage.SectorRef, return out, waitErr } -func (m *Manager) SealPreCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.PreCommit1Out) (out storage.SectorCids, err error) { +func (m *Manager) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.PreCommit1Out) (out storiface.SectorCids, err error) { ctx, cancel := context.WithCancel(ctx) defer cancel() wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTPreCommit2, sector, phase1Out) if err != nil { - return storage.SectorCids{}, xerrors.Errorf("getWork: %w", err) + return storiface.SectorCids{}, xerrors.Errorf("getWork: %w", err) } defer cancel() @@ -461,7 +460,7 @@ func (m *Manager) SealPreCommit2(ctx context.Context, sector storage.SectorRef, return } if p != nil { - out = p.(storage.SectorCids) + out = p.(storiface.SectorCids) } } @@ -471,7 +470,7 @@ func (m *Manager) SealPreCommit2(ctx context.Context, sector storage.SectorRef, } if err := m.index.StorageLock(ctx, sector.ID, storiface.FTSealed, storiface.FTCache); err != nil { - return storage.SectorCids{}, xerrors.Errorf("acquiring sector lock: %w", err) + return storiface.SectorCids{}, xerrors.Errorf("acquiring sector lock: %w", err) } selector := newExistingSelector(m.index, sector.ID, storiface.FTCache|storiface.FTSealed, true) @@ -486,19 +485,19 @@ func (m *Manager) SealPreCommit2(ctx context.Context, sector storage.SectorRef, return nil }) if err != nil { - return storage.SectorCids{}, err + return storiface.SectorCids{}, err } return out, waitErr } -func (m *Manager) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (out storage.Commit1Out, err error) { +func (m *Manager) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (out storiface.Commit1Out, err error) { ctx, cancel := context.WithCancel(ctx) defer cancel() wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTCommit1, sector, ticket, seed, pieces, cids) if err != nil { - return storage.Commit1Out{}, xerrors.Errorf("getWork: %w", err) + return storiface.Commit1Out{}, xerrors.Errorf("getWork: %w", err) } defer cancel() @@ -510,7 +509,7 @@ func (m *Manager) SealCommit1(ctx context.Context, sector storage.SectorRef, tic return } if p != nil { - out = p.(storage.Commit1Out) + out = p.(storiface.Commit1Out) } } @@ -520,7 +519,7 @@ func (m *Manager) SealCommit1(ctx context.Context, sector storage.SectorRef, tic } if err := m.index.StorageLock(ctx, sector.ID, storiface.FTSealed, storiface.FTCache); err != nil { - return storage.Commit1Out{}, xerrors.Errorf("acquiring sector lock: %w", err) + return storiface.Commit1Out{}, xerrors.Errorf("acquiring sector lock: %w", err) } // NOTE: We set allowFetch to false in so that we always execute on a worker @@ -544,10 +543,10 @@ func (m *Manager) SealCommit1(ctx context.Context, sector storage.SectorRef, tic return out, waitErr } -func (m *Manager) SealCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.Commit1Out) (out storage.Proof, err error) { +func (m *Manager) SealCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.Commit1Out) (out storiface.Proof, err error) { wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTCommit2, sector, phase1Out) if err != nil { - return storage.Proof{}, xerrors.Errorf("getWork: %w", err) + return storiface.Proof{}, xerrors.Errorf("getWork: %w", err) } defer cancel() @@ -559,7 +558,7 @@ func (m *Manager) SealCommit2(ctx context.Context, sector storage.SectorRef, pha return } if p != nil { - out = p.(storage.Proof) + out = p.(storiface.Proof) } } @@ -587,7 +586,7 @@ func (m *Manager) SealCommit2(ctx context.Context, sector storage.SectorRef, pha return out, waitErr } -func (m *Manager) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { +func (m *Manager) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -664,7 +663,7 @@ func (m *Manager) FinalizeSector(ctx context.Context, sector storage.SectorRef, return nil } -func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { +func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -750,7 +749,7 @@ func (m *Manager) FinalizeReplicaUpdate(ctx context.Context, sector storage.Sect return nil } -func (m *Manager) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error { +func (m *Manager) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error { ssize, err := sector.ProofType.SectorSize() if err != nil { return err @@ -770,7 +769,7 @@ func (m *Manager) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, return m.storage.Remove(ctx, sector.ID, storiface.FTUnsealed, true, nil) } -func (m *Manager) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef) error { +func (m *Manager) ReleaseSectorKey(ctx context.Context, sector storiface.SectorRef) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -781,7 +780,7 @@ func (m *Manager) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef return m.storage.Remove(ctx, sector.ID, storiface.FTSealed, true, nil) } -func (m *Manager) ReleaseReplicaUpgrade(ctx context.Context, sector storage.SectorRef) error { +func (m *Manager) ReleaseReplicaUpgrade(ctx context.Context, sector storiface.SectorRef) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -798,7 +797,7 @@ func (m *Manager) ReleaseReplicaUpgrade(ctx context.Context, sector storage.Sect return nil } -func (m *Manager) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) error { +func (m *Manager) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -848,7 +847,7 @@ func (m *Manager) GenerateSectorKeyFromData(ctx context.Context, sector storage. return waitErr } -func (m *Manager) Remove(ctx context.Context, sector storage.SectorRef) error { +func (m *Manager) Remove(ctx context.Context, sector storiface.SectorRef) error { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -877,13 +876,13 @@ func (m *Manager) Remove(ctx context.Context, sector storage.SectorRef) error { return err } -func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (out storage.ReplicaUpdateOut, err error) { +func (m *Manager) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (out storiface.ReplicaUpdateOut, err error) { ctx, cancel := context.WithCancel(ctx) defer cancel() log.Debugf("manager is doing replica update") wk, wait, cancel, err := m.getWork(ctx, sealtasks.TTReplicaUpdate, sector, pieces) if err != nil { - return storage.ReplicaUpdateOut{}, xerrors.Errorf("getWork: %w", err) + return storiface.ReplicaUpdateOut{}, xerrors.Errorf("getWork: %w", err) } defer cancel() @@ -895,7 +894,7 @@ func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p return } if p != nil { - out = p.(storage.ReplicaUpdateOut) + out = p.(storiface.ReplicaUpdateOut) } } @@ -905,7 +904,7 @@ func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p } if err := m.index.StorageLock(ctx, sector.ID, storiface.FTUnsealed|storiface.FTSealed|storiface.FTCache, storiface.FTUpdate|storiface.FTUpdateCache); err != nil { - return storage.ReplicaUpdateOut{}, xerrors.Errorf("acquiring sector lock: %w", err) + return storiface.ReplicaUpdateOut{}, xerrors.Errorf("acquiring sector lock: %w", err) } selector := newAllocSelector(m.index, storiface.FTUpdate|storiface.FTUpdateCache, storiface.PathSealing) @@ -920,12 +919,12 @@ func (m *Manager) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, p return nil }) if err != nil { - return storage.ReplicaUpdateOut{}, xerrors.Errorf("Schedule: %w", err) + return storiface.ReplicaUpdateOut{}, xerrors.Errorf("Schedule: %w", err) } return out, waitErr } -func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (out storage.ReplicaVanillaProofs, err error) { +func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (out storiface.ReplicaVanillaProofs, err error) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -943,7 +942,7 @@ func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storage.Sector return } if p != nil { - out = p.(storage.ReplicaVanillaProofs) + out = p.(storiface.ReplicaVanillaProofs) } } @@ -978,7 +977,7 @@ func (m *Manager) ProveReplicaUpdate1(ctx context.Context, sector storage.Sector return out, waitErr } -func (m *Manager) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (out storage.ReplicaUpdateProof, err error) { +func (m *Manager) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (out storiface.ReplicaUpdateProof, err error) { ctx, cancel := context.WithCancel(ctx) defer cancel() @@ -996,7 +995,7 @@ func (m *Manager) ProveReplicaUpdate2(ctx context.Context, sector storage.Sector return } if p != nil { - out = p.(storage.ReplicaUpdateProof) + out = p.(storiface.ReplicaUpdateProof) } } @@ -1032,19 +1031,19 @@ func (m *Manager) ReturnAddPiece(ctx context.Context, callID storiface.CallID, p return m.returnResult(ctx, callID, pi, err) } -func (m *Manager) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storage.PreCommit1Out, err *storiface.CallError) error { +func (m *Manager) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storiface.PreCommit1Out, err *storiface.CallError) error { return m.returnResult(ctx, callID, p1o, err) } -func (m *Manager) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storage.SectorCids, err *storiface.CallError) error { +func (m *Manager) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storiface.SectorCids, err *storiface.CallError) error { return m.returnResult(ctx, callID, sealed, err) } -func (m *Manager) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storage.Commit1Out, err *storiface.CallError) error { +func (m *Manager) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storiface.Commit1Out, err *storiface.CallError) error { return m.returnResult(ctx, callID, out, err) } -func (m *Manager) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storage.Proof, err *storiface.CallError) error { +func (m *Manager) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storiface.Proof, err *storiface.CallError) error { return m.returnResult(ctx, callID, proof, err) } @@ -1056,15 +1055,15 @@ func (m *Manager) ReturnReleaseUnsealed(ctx context.Context, callID storiface.Ca return m.returnResult(ctx, callID, nil, err) } -func (m *Manager) ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storage.ReplicaUpdateOut, err *storiface.CallError) error { +func (m *Manager) ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storiface.ReplicaUpdateOut, err *storiface.CallError) error { return m.returnResult(ctx, callID, out, err) } -func (m *Manager) ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, out storage.ReplicaVanillaProofs, err *storiface.CallError) error { +func (m *Manager) ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, out storiface.ReplicaVanillaProofs, err *storiface.CallError) error { return m.returnResult(ctx, callID, out, err) } -func (m *Manager) ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, proof storage.ReplicaUpdateProof, err *storiface.CallError) error { +func (m *Manager) ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, proof storiface.ReplicaUpdateProof, err *storiface.CallError) error { return m.returnResult(ctx, callID, proof, err) } diff --git a/storage/sealer/manager_test.go b/storage/sealer/manager_test.go index f5695fc11..f71452b5e 100644 --- a/storage/sealer/manager_test.go +++ b/storage/sealer/manager_test.go @@ -27,7 +27,6 @@ import ( "github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-statestore" proof7 "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" @@ -157,7 +156,7 @@ func TestSimple(t *testing.T) { }, lstor, m)) require.NoError(t, err) - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{Miner: 1000, Number: 1}, ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1, } @@ -233,7 +232,7 @@ func TestSnapDeals(t *testing.T) { log.Warn("Continuing test with 2k sectors") } - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{Miner: 1000, Number: 1}, ProofType: proofType, } @@ -311,7 +310,7 @@ func TestSnapDeals(t *testing.T) { fmt.Printf("Decode duration (%s): %s\n", ss.ShortString(), time.Since(startDecode)) // Remove just the first piece and decode for retrieval - require.NoError(t, m.FinalizeSector(ctx, sid, []storage.Range{{Offset: p1.Size.Unpadded(), Size: p2.Size.Unpadded()}})) + require.NoError(t, m.FinalizeSector(ctx, sid, []storiface.Range{{Offset: p1.Size.Unpadded(), Size: p2.Size.Unpadded()}})) require.NoError(t, m.SectorsUnsealPiece(ctx, sid, 0, p1.Size.Unpadded(), ticket, &out.NewUnsealed)) fmt.Printf("GSK\n") @@ -364,12 +363,12 @@ func TestSnarkPackV2(t *testing.T) { mid := abi.ActorID(1000) - sid1 := storage.SectorRef{ + sid1 := storiface.SectorRef{ ID: abi.SectorID{Miner: mid, Number: 1}, ProofType: proofType, } - sid2 := storage.SectorRef{ + sid2 := storiface.SectorRef{ ID: abi.SectorID{Miner: mid, Number: 2}, ProofType: proofType, } @@ -487,7 +486,7 @@ func TestRedoPC1(t *testing.T) { err := m.AddWorker(ctx, tw) require.NoError(t, err) - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{Miner: 1000, Number: 1}, ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1, } @@ -542,7 +541,7 @@ func TestRestartManager(t *testing.T) { err := m.AddWorker(ctx, tw) require.NoError(t, err) - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{Miner: 1000, Number: 1}, ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1, } @@ -645,7 +644,7 @@ func TestRestartWorker(t *testing.T) { err := m.AddWorker(ctx, w) require.NoError(t, err) - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{Miner: 1000, Number: 1}, ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1, } @@ -793,7 +792,7 @@ func TestResUse(t *testing.T) { err := m.AddWorker(ctx, w) require.NoError(t, err) - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{Miner: 1000, Number: 1}, ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1, } @@ -855,7 +854,7 @@ func TestResOverride(t *testing.T) { err := m.AddWorker(ctx, w) require.NoError(t, err) - sid := storage.SectorRef{ + sid := storiface.SectorRef{ ID: abi.SectorID{Miner: 1000, Number: 1}, ProofType: abi.RegisteredSealProof_StackedDrg2KiBV1, } diff --git a/storage/sealer/mock/mock.go b/storage/sealer/mock/mock.go index ae35f9695..42ce75501 100644 --- a/storage/sealer/mock/mock.go +++ b/storage/sealer/mock/mock.go @@ -19,7 +19,6 @@ import ( commcid "github.com/filecoin-project/go-fil-commcid" "github.com/filecoin-project/go-state-types/abi" prooftypes "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -72,11 +71,11 @@ type sectorState struct { lk sync.Mutex } -func (mgr *SectorMgr) NewSector(ctx context.Context, sector storage.SectorRef) error { +func (mgr *SectorMgr) NewSector(ctx context.Context, sector storiface.SectorRef) error { return nil } -func (mgr *SectorMgr) SectorsUnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error { +func (mgr *SectorMgr) SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error { panic("SectorMgr: unsealing piece: implement me") } @@ -84,7 +83,7 @@ func (mgr *SectorMgr) DataCid(ctx context.Context, size abi.UnpaddedPieceSize, r panic("todo") } -func (mgr *SectorMgr) AddPiece(ctx context.Context, sectorID storage.SectorRef, existingPieces []abi.UnpaddedPieceSize, size abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) { +func (mgr *SectorMgr) AddPiece(ctx context.Context, sectorID storiface.SectorRef, existingPieces []abi.UnpaddedPieceSize, size abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) { log.Warn("Add piece: ", sectorID, size, sectorID.ProofType) var b bytes.Buffer @@ -128,11 +127,11 @@ func (mgr *SectorMgr) AcquireSectorNumber() (abi.SectorNumber, error) { return id, nil } -func (mgr *SectorMgr) IsUnsealed(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) { +func (mgr *SectorMgr) IsUnsealed(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) { return false, nil } -func (mgr *SectorMgr) ForceState(sid storage.SectorRef, st int) error { +func (mgr *SectorMgr) ForceState(sid storiface.SectorRef, st int) error { mgr.lk.Lock() ss, ok := mgr.sectors[sid.ID] mgr.lk.Unlock() @@ -145,7 +144,7 @@ func (mgr *SectorMgr) ForceState(sid storage.SectorRef, st int) error { return nil } -func (mgr *SectorMgr) SealPreCommit1(ctx context.Context, sid storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storage.PreCommit1Out, err error) { +func (mgr *SectorMgr) SealPreCommit1(ctx context.Context, sid storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (out storiface.PreCommit1Out, err error) { mgr.lk.Lock() ss, ok := mgr.sectors[sid.ID] mgr.lk.Unlock() @@ -205,7 +204,7 @@ func (mgr *SectorMgr) SealPreCommit1(ctx context.Context, sid storage.SectorRef, return cc, nil } -func (mgr *SectorMgr) SealPreCommit2(ctx context.Context, sid storage.SectorRef, phase1Out storage.PreCommit1Out) (cids storage.SectorCids, err error) { +func (mgr *SectorMgr) SealPreCommit2(ctx context.Context, sid storiface.SectorRef, phase1Out storiface.PreCommit1Out) (cids storiface.SectorCids, err error) { db := []byte(string(phase1Out)) db[0] ^= 'd' @@ -218,13 +217,13 @@ func (mgr *SectorMgr) SealPreCommit2(ctx context.Context, sid storage.SectorRef, commR, _ := commcid.ReplicaCommitmentV1ToCID(commr) - return storage.SectorCids{ + return storiface.SectorCids{ Unsealed: d, Sealed: commR, }, nil } -func (mgr *SectorMgr) SealCommit1(ctx context.Context, sid storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (output storage.Commit1Out, err error) { +func (mgr *SectorMgr) SealCommit1(ctx context.Context, sid storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (output storiface.Commit1Out, err error) { mgr.lk.Lock() ss, ok := mgr.sectors[sid.ID] mgr.lk.Unlock() @@ -252,7 +251,7 @@ func (mgr *SectorMgr) SealCommit1(ctx context.Context, sid storage.SectorRef, ti return out[:], nil } -func (mgr *SectorMgr) SealCommit2(ctx context.Context, sid storage.SectorRef, phase1Out storage.Commit1Out) (proof storage.Proof, err error) { +func (mgr *SectorMgr) SealCommit2(ctx context.Context, sid storiface.SectorRef, phase1Out storiface.Commit1Out) (proof storiface.Proof, err error) { plen, err := sid.ProofType.ProofSize() if err != nil { return nil, err @@ -266,31 +265,31 @@ func (mgr *SectorMgr) SealCommit2(ctx context.Context, sid storage.SectorRef, ph return out[:], nil } -func (mgr *SectorMgr) ReplicaUpdate(ctx context.Context, sid storage.SectorRef, pieces []abi.PieceInfo) (storage.ReplicaUpdateOut, error) { - out := storage.ReplicaUpdateOut{} +func (mgr *SectorMgr) ReplicaUpdate(ctx context.Context, sid storiface.SectorRef, pieces []abi.PieceInfo) (storiface.ReplicaUpdateOut, error) { + out := storiface.ReplicaUpdateOut{} return out, nil } -func (mgr *SectorMgr) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storage.ReplicaVanillaProofs, error) { +func (mgr *SectorMgr) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.ReplicaVanillaProofs, error) { out := make([][]byte, 0) return out, nil } -func (mgr *SectorMgr) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storage.ReplicaUpdateProof, error) { +func (mgr *SectorMgr) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.ReplicaUpdateProof, error) { return make([]byte, 0), nil } -func (mgr *SectorMgr) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) error { +func (mgr *SectorMgr) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) error { return nil } -func (mgr *SectorMgr) ReleaseSealed(ctx context.Context, sid storage.SectorRef) error { +func (mgr *SectorMgr) ReleaseSealed(ctx context.Context, sid storiface.SectorRef) error { return nil } // Test Instrumentation Methods -func (mgr *SectorMgr) MarkFailed(sid storage.SectorRef, failed bool) error { +func (mgr *SectorMgr) MarkFailed(sid storiface.SectorRef, failed bool) error { mgr.lk.Lock() defer mgr.lk.Unlock() ss, ok := mgr.sectors[sid.ID] @@ -310,7 +309,7 @@ func (mgr *SectorMgr) Fail() { return } -func (mgr *SectorMgr) MarkCorrupted(sid storage.SectorRef, corrupted bool) error { +func (mgr *SectorMgr) MarkCorrupted(sid storiface.SectorRef, corrupted bool) error { mgr.lk.Lock() defer mgr.lk.Unlock() ss, ok := mgr.sectors[sid.ID] @@ -437,7 +436,7 @@ func (mgr *SectorMgr) GenerateWindowPoStWithVanilla(ctx context.Context, proofTy panic("implement me") } -func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) { +func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) { off := storiface.UnpaddedByteIndex(0) var piece cid.Cid for _, c := range mgr.sectors[sector.ID].pieces { @@ -463,21 +462,21 @@ func (mgr *SectorMgr) ReadPiece(ctx context.Context, sector storage.SectorRef, o }, false, nil } -func (mgr *SectorMgr) StageFakeData(mid abi.ActorID, spt abi.RegisteredSealProof) (storage.SectorRef, []abi.PieceInfo, error) { +func (mgr *SectorMgr) StageFakeData(mid abi.ActorID, spt abi.RegisteredSealProof) (storiface.SectorRef, []abi.PieceInfo, error) { psize, err := spt.SectorSize() if err != nil { - return storage.SectorRef{}, nil, err + return storiface.SectorRef{}, nil, err } usize := abi.PaddedPieceSize(psize).Unpadded() sid, err := mgr.AcquireSectorNumber() if err != nil { - return storage.SectorRef{}, nil, err + return storiface.SectorRef{}, nil, err } buf := make([]byte, usize) _, _ = rand.Read(buf) // nolint:gosec - id := storage.SectorRef{ + id := storiface.SectorRef{ ID: abi.SectorID{ Miner: mid, Number: sid, @@ -487,33 +486,33 @@ func (mgr *SectorMgr) StageFakeData(mid abi.ActorID, spt abi.RegisteredSealProof pi, err := mgr.AddPiece(context.TODO(), id, nil, usize, bytes.NewReader(buf)) if err != nil { - return storage.SectorRef{}, nil, err + return storiface.SectorRef{}, nil, err } return id, []abi.PieceInfo{pi}, nil } -func (mgr *SectorMgr) FinalizeSector(context.Context, storage.SectorRef, []storage.Range) error { +func (mgr *SectorMgr) FinalizeSector(context.Context, storiface.SectorRef, []storiface.Range) error { return nil } -func (mgr *SectorMgr) FinalizeReplicaUpdate(context.Context, storage.SectorRef, []storage.Range) error { +func (mgr *SectorMgr) FinalizeReplicaUpdate(context.Context, storiface.SectorRef, []storiface.Range) error { return nil } -func (mgr *SectorMgr) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error { +func (mgr *SectorMgr) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error { return nil } -func (mgr *SectorMgr) ReleaseReplicaUpgrade(ctx context.Context, sector storage.SectorRef) error { +func (mgr *SectorMgr) ReleaseReplicaUpgrade(ctx context.Context, sector storiface.SectorRef) error { return nil } -func (mgr *SectorMgr) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef) error { +func (mgr *SectorMgr) ReleaseSectorKey(ctx context.Context, sector storiface.SectorRef) error { return nil } -func (mgr *SectorMgr) Remove(ctx context.Context, sector storage.SectorRef) error { +func (mgr *SectorMgr) Remove(ctx context.Context, sector storiface.SectorRef) error { mgr.lk.Lock() defer mgr.lk.Unlock() @@ -525,7 +524,7 @@ func (mgr *SectorMgr) Remove(ctx context.Context, sector storage.SectorRef) erro return nil } -func (mgr *SectorMgr) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, ids []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) { +func (mgr *SectorMgr) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, ids []storiface.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) { bad := map[abi.SectorID]string{} for _, sid := range ids { @@ -549,19 +548,19 @@ func (mgr *SectorMgr) ReturnAddPiece(ctx context.Context, callID storiface.CallI panic("not supported") } -func (mgr *SectorMgr) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storage.PreCommit1Out, err *storiface.CallError) error { +func (mgr *SectorMgr) ReturnSealPreCommit1(ctx context.Context, callID storiface.CallID, p1o storiface.PreCommit1Out, err *storiface.CallError) error { panic("not supported") } -func (mgr *SectorMgr) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storage.SectorCids, err *storiface.CallError) error { +func (mgr *SectorMgr) ReturnSealPreCommit2(ctx context.Context, callID storiface.CallID, sealed storiface.SectorCids, err *storiface.CallError) error { panic("not supported") } -func (mgr *SectorMgr) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storage.Commit1Out, err *storiface.CallError) error { +func (mgr *SectorMgr) ReturnSealCommit1(ctx context.Context, callID storiface.CallID, out storiface.Commit1Out, err *storiface.CallError) error { panic("not supported") } -func (mgr *SectorMgr) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storage.Proof, err *storiface.CallError) error { +func (mgr *SectorMgr) ReturnSealCommit2(ctx context.Context, callID storiface.CallID, proof storiface.Proof, err *storiface.CallError) error { panic("not supported") } @@ -589,15 +588,15 @@ func (mgr *SectorMgr) ReturnFetch(ctx context.Context, callID storiface.CallID, panic("not supported") } -func (mgr *SectorMgr) ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storage.ReplicaUpdateOut, err *storiface.CallError) error { +func (mgr *SectorMgr) ReturnReplicaUpdate(ctx context.Context, callID storiface.CallID, out storiface.ReplicaUpdateOut, err *storiface.CallError) error { panic("not supported") } -func (mgr *SectorMgr) ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, out storage.ReplicaVanillaProofs, err *storiface.CallError) error { +func (mgr *SectorMgr) ReturnProveReplicaUpdate1(ctx context.Context, callID storiface.CallID, out storiface.ReplicaVanillaProofs, err *storiface.CallError) error { panic("not supported") } -func (mgr *SectorMgr) ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, out storage.ReplicaUpdateProof, err *storiface.CallError) error { +func (mgr *SectorMgr) ReturnProveReplicaUpdate2(ctx context.Context, callID storiface.CallID, out storiface.ReplicaUpdateProof, err *storiface.CallError) error { panic("not supported") } @@ -735,6 +734,6 @@ var MockVerifier = mockVerifProver{ var MockProver = MockVerifier -var _ storage.Sealer = &SectorMgr{} +var _ storiface.Sealer = &SectorMgr{} var _ ffiwrapper.Verifier = MockVerifier var _ ffiwrapper.Prover = MockProver diff --git a/storage/sealer/piece_provider.go b/storage/sealer/piece_provider.go index e3e1ca23a..f49b8b0c7 100644 --- a/storage/sealer/piece_provider.go +++ b/storage/sealer/piece_provider.go @@ -10,7 +10,6 @@ import ( "github.com/filecoin-project/dagstore/mount" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/sealer/fr32" @@ -19,7 +18,7 @@ import ( type Unsealer interface { // SectorsUnsealPiece will Unseal a Sealed sector file for the given sector. - SectorsUnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error + SectorsUnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd *cid.Cid) error } type PieceProvider interface { @@ -28,8 +27,8 @@ type PieceProvider interface { // default in most cases, but this might matter with future PoRep) // startOffset is added to the pieceOffset to get the starting reader offset. // The number of bytes that can be read is pieceSize-startOffset - ReadPiece(ctx context.Context, sector storage.SectorRef, pieceOffset storiface.UnpaddedByteIndex, pieceSize abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) - IsUnsealed(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) + ReadPiece(ctx context.Context, sector storiface.SectorRef, pieceOffset storiface.UnpaddedByteIndex, pieceSize abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) + IsUnsealed(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) } var _ PieceProvider = &pieceProvider{} @@ -50,7 +49,7 @@ func NewPieceProvider(storage *paths.Remote, index paths.SectorIndex, uns Unseal // IsUnsealed checks if we have the unsealed piece at the given offset in an already // existing unsealed file either locally or on any of the workers. -func (p *pieceProvider) IsUnsealed(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) { +func (p *pieceProvider) IsUnsealed(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) { if err := offset.Valid(); err != nil { return false, xerrors.Errorf("offset is not valid: %w", err) } @@ -72,7 +71,7 @@ func (p *pieceProvider) IsUnsealed(ctx context.Context, sector storage.SectorRef // It will NOT try to schedule an Unseal of a sealed sector file for the read. // // Returns a nil reader if the piece does NOT exist in any unsealed file or there is no unsealed file for the given sector on any of the workers. -func (p *pieceProvider) tryReadUnsealedPiece(ctx context.Context, pc cid.Cid, sector storage.SectorRef, pieceOffset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (mount.Reader, error) { +func (p *pieceProvider) tryReadUnsealedPiece(ctx context.Context, pc cid.Cid, sector storiface.SectorRef, pieceOffset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (mount.Reader, error) { // acquire a lock purely for reading unsealed sectors ctx, cancel := context.WithCancel(ctx) if err := p.index.StorageLock(ctx, sector.ID, storiface.FTUnsealed, storiface.FTNone); err != nil { @@ -156,7 +155,7 @@ var _ io.Closer = funcCloser(nil) // If we do NOT have an existing unsealed file containing the given piece thus causing us to schedule an Unseal, // the returned boolean parameter will be set to true. // If we have an existing unsealed file containing the given piece, the returned boolean will be set to false. -func (p *pieceProvider) ReadPiece(ctx context.Context, sector storage.SectorRef, pieceOffset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) { +func (p *pieceProvider) ReadPiece(ctx context.Context, sector storiface.SectorRef, pieceOffset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, ticket abi.SealRandomness, unsealed cid.Cid) (mount.Reader, bool, error) { if err := pieceOffset.Valid(); err != nil { return nil, false, xerrors.Errorf("pieceOffset is not valid: %w", err) } diff --git a/storage/sealer/piece_provider_test.go b/storage/sealer/piece_provider_test.go index 6d9525b0a..8da155604 100644 --- a/storage/sealer/piece_provider_test.go +++ b/storage/sealer/piece_provider_test.go @@ -20,7 +20,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-statestore" - specstorage "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/sealer/sealtasks" @@ -182,7 +181,7 @@ type pieceProviderTestHarness struct { ctx context.Context index *paths.Index pp PieceProvider - sector specstorage.SectorRef + sector storiface.SectorRef mgr *Manager ticket abi.SealRandomness commD cid.Cid @@ -232,7 +231,7 @@ func newPieceProviderTestHarness(t *testing.T, mgrConfig Config, sectorProofType pp := NewPieceProvider(remoteStore, index, mgr) - sector := specstorage.SectorRef{ + sector := storiface.SectorRef{ ID: abi.SectorID{ Miner: 100, Number: 10, @@ -318,13 +317,13 @@ func (p *pieceProviderTestHarness) addPiece(t *testing.T, pieceData []byte) abi. return pieceInfo } -func (p *pieceProviderTestHarness) preCommit1(t *testing.T) specstorage.PreCommit1Out { +func (p *pieceProviderTestHarness) preCommit1(t *testing.T) storiface.PreCommit1Out { preCommit1, err := p.mgr.SealPreCommit1(p.ctx, p.sector, p.ticket, p.addedPieces) require.NoError(t, err) return preCommit1 } -func (p *pieceProviderTestHarness) preCommit2(t *testing.T, pc1 specstorage.PreCommit1Out) { +func (p *pieceProviderTestHarness) preCommit2(t *testing.T, pc1 storiface.PreCommit1Out) { sectorCids, err := p.mgr.SealPreCommit2(p.ctx, p.sector, pc1) require.NoError(t, err) commD := sectorCids.Unsealed @@ -351,7 +350,7 @@ func (p *pieceProviderTestHarness) readPiece(t *testing.T, offset storiface.Unpa require.Equal(t, expectedBytes, readData) } -func (p *pieceProviderTestHarness) finalizeSector(t *testing.T, keepUnseal []specstorage.Range) { +func (p *pieceProviderTestHarness) finalizeSector(t *testing.T, keepUnseal []storiface.Range) { require.NoError(t, p.mgr.FinalizeSector(p.ctx, p.sector, keepUnseal)) } diff --git a/storage/sealer/roprov.go b/storage/sealer/roprov.go index e57f6a2c1..c225fda78 100644 --- a/storage/sealer/roprov.go +++ b/storage/sealer/roprov.go @@ -5,8 +5,6 @@ import ( "golang.org/x/xerrors" - "github.com/filecoin-project/specs-storage/storage" - "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/sealer/storiface" ) @@ -16,7 +14,7 @@ type readonlyProvider struct { stor *paths.Local } -func (l *readonlyProvider) AcquireSector(ctx context.Context, id storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType) (storiface.SectorPaths, func(), error) { +func (l *readonlyProvider) AcquireSector(ctx context.Context, id storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType) (storiface.SectorPaths, func(), error) { if allocate != storiface.FTNone { return storiface.SectorPaths{}, nil, xerrors.New("read-only storage") } diff --git a/storage/sealer/sched.go b/storage/sealer/sched.go index 192e415c8..323def986 100644 --- a/storage/sealer/sched.go +++ b/storage/sealer/sched.go @@ -9,7 +9,6 @@ import ( "golang.org/x/xerrors" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/sealtasks" "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -119,7 +118,7 @@ type workerDisableReq struct { } type WorkerRequest struct { - Sector storage.SectorRef + Sector storiface.SectorRef TaskType sealtasks.TaskType Priority int // larger values more important Sel WorkerSelector @@ -176,7 +175,7 @@ func newScheduler(assigner string) (*Scheduler, error) { }, nil } -func (sh *Scheduler) Schedule(ctx context.Context, sector storage.SectorRef, taskType sealtasks.TaskType, sel WorkerSelector, prepare WorkerAction, work WorkerAction) error { +func (sh *Scheduler) Schedule(ctx context.Context, sector storiface.SectorRef, taskType sealtasks.TaskType, sel WorkerSelector, prepare WorkerAction, work WorkerAction) error { ret := make(chan workerResponse) select { diff --git a/storage/sealer/sched_test.go b/storage/sealer/sched_test.go index 8ebaa317a..258383e90 100644 --- a/storage/sealer/sched_test.go +++ b/storage/sealer/sched_test.go @@ -18,7 +18,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" prooftypes "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/sealer/fsutil" @@ -68,79 +67,79 @@ type schedTestWorker struct { ignoreResources bool } -func (s *schedTestWorker) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) { +func (s *schedTestWorker) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) { +func (s *schedTestWorker) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (storiface.CallID, error) { +func (s *schedTestWorker) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storiface.CallID, error) { +func (s *schedTestWorker) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (storiface.CallID, error) { +func (s *schedTestWorker) SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) { +func (s *schedTestWorker) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (storiface.CallID, error) { +func (s *schedTestWorker) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) Remove(ctx context.Context, sector storage.SectorRef) (storiface.CallID, error) { +func (s *schedTestWorker) Remove(ctx context.Context, sector storiface.SectorRef) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) NewSector(ctx context.Context, sector storage.SectorRef) (storiface.CallID, error) { +func (s *schedTestWorker) NewSector(ctx context.Context, sector storiface.SectorRef) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) { +func (s *schedTestWorker) AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, peices []abi.PieceInfo) (storiface.CallID, error) { +func (s *schedTestWorker) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, peices []abi.PieceInfo) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) { +func (s *schedTestWorker) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storiface.CallID, error) { +func (s *schedTestWorker) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) (storiface.CallID, error) { +func (s *schedTestWorker) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) { +func (s *schedTestWorker) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) MoveStorage(ctx context.Context, sector storage.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) { +func (s *schedTestWorker) MoveStorage(ctx context.Context, sector storiface.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) Fetch(ctx context.Context, id storage.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) { +func (s *schedTestWorker) Fetch(ctx context.Context, id storiface.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) UnsealPiece(ctx context.Context, id storage.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, cid cid.Cid) (storiface.CallID, error) { +func (s *schedTestWorker) UnsealPiece(ctx context.Context, id storiface.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, cid cid.Cid) (storiface.CallID, error) { panic("implement me") } -func (s *schedTestWorker) ReadPiece(ctx context.Context, writer io.Writer, id storage.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (storiface.CallID, error) { +func (s *schedTestWorker) ReadPiece(ctx context.Context, writer io.Writer, id storiface.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (storiface.CallID, error) { panic("implement me") } @@ -276,7 +275,7 @@ func TestSched(t *testing.T) { go func() { defer rm.wg.Done() - sectorRef := storage.SectorRef{ + sectorRef := storiface.SectorRef{ ID: abi.SectorID{ Miner: 8, Number: sid, @@ -666,7 +665,7 @@ func TestWindowCompact(t *testing.T) { for _, task := range windowTasks { window.Todo = append(window.Todo, &WorkerRequest{ TaskType: task, - Sector: storage.SectorRef{ProofType: spt}, + Sector: storiface.SectorRef{ProofType: spt}, }) window.Allocated.Add(task.SealTask(spt), wh.Info.Resources, storiface.ResourceTable[task][spt]) } diff --git a/storage/sealer/storiface/paths.go b/storage/sealer/storiface/paths.go new file mode 100644 index 000000000..624b71d77 --- /dev/null +++ b/storage/sealer/storiface/paths.go @@ -0,0 +1,31 @@ +package storiface + +import "github.com/filecoin-project/go-state-types/abi" + +type PathType string + +const ( + PathStorage PathType = "storage" + PathSealing PathType = "sealing" +) + +type AcquireMode string + +const ( + AcquireMove AcquireMode = "move" + AcquireCopy AcquireMode = "copy" +) + +type Refs struct { + RefCount [FileTypes]uint +} + +type SectorLock struct { + Sector abi.SectorID + Write [FileTypes]uint + Read [FileTypes]uint +} + +type SectorLocks struct { + Locks []SectorLock +} diff --git a/storage/sealer/storiface/storage.go b/storage/sealer/storiface/storage.go index 624b71d77..2872b76ac 100644 --- a/storage/sealer/storiface/storage.go +++ b/storage/sealer/storiface/storage.go @@ -1,31 +1,94 @@ package storiface -import "github.com/filecoin-project/go-state-types/abi" +import ( + "context" + "io" -type PathType string + "github.com/ipfs/go-cid" -const ( - PathStorage PathType = "storage" - PathSealing PathType = "sealing" + "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/proof" ) -type AcquireMode string +type Data = io.Reader -const ( - AcquireMove AcquireMode = "move" - AcquireCopy AcquireMode = "copy" -) - -type Refs struct { - RefCount [FileTypes]uint +type SectorRef struct { + ID abi.SectorID + ProofType abi.RegisteredSealProof } -type SectorLock struct { - Sector abi.SectorID - Write [FileTypes]uint - Read [FileTypes]uint +var NoSectorRef = SectorRef{} + +type Storage interface { + // Creates a new empty sector (only allocate on disk. Layers above + // storage are responsible for assigning sector IDs) + NewSector(ctx context.Context, sector SectorRef) error + // Compute Data CID + DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData Data) (abi.PieceInfo, error) + // Add a piece to an existing *unsealed* sector + AddPiece(ctx context.Context, sector SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData Data) (abi.PieceInfo, error) } -type SectorLocks struct { - Locks []SectorLock +type Prover interface { + GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error) + GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.ExtendedSectorInfo, randomness abi.PoStRandomness) (proof []proof.PoStProof, skipped []abi.SectorID, err error) + + GenerateWinningPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte) ([]proof.PoStProof, error) + GenerateWindowPoStWithVanilla(ctx context.Context, proofType abi.RegisteredPoStProof, minerID abi.ActorID, randomness abi.PoStRandomness, proofs [][]byte, partitionIdx int) (proof.PoStProof, error) +} + +type PreCommit1Out []byte + +type Commit1Out []byte + +type Proof []byte + +type SectorCids struct { + Unsealed cid.Cid + Sealed cid.Cid +} + +type Range struct { + Offset abi.UnpaddedPieceSize + Size abi.UnpaddedPieceSize +} + +type ReplicaUpdateProof []byte +type ReplicaVanillaProofs [][]byte + +type ReplicaUpdateOut struct { + NewSealed cid.Cid + NewUnsealed cid.Cid +} + +type Sealer interface { + SealPreCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (PreCommit1Out, error) + SealPreCommit2(ctx context.Context, sector SectorRef, pc1o PreCommit1Out) (SectorCids, error) + + SealCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids SectorCids) (Commit1Out, error) + SealCommit2(ctx context.Context, sector SectorRef, c1o Commit1Out) (Proof, error) + + FinalizeSector(ctx context.Context, sector SectorRef, keepUnsealed []Range) error + + // ReleaseUnsealed marks parts of the unsealed sector file as safe to drop + // (called by the fsm on restart, allows storage to keep no persistent + // state about unsealed fast-retrieval copies) + ReleaseUnsealed(ctx context.Context, sector SectorRef, safeToFree []Range) error + ReleaseSectorKey(ctx context.Context, sector SectorRef) error + ReleaseReplicaUpgrade(ctx context.Context, sector SectorRef) error + + // Removes all data associated with the specified sector + Remove(ctx context.Context, sector SectorRef) error + + // Generate snap deals replica update + ReplicaUpdate(ctx context.Context, sector SectorRef, pieces []abi.PieceInfo) (ReplicaUpdateOut, error) + + // Prove that snap deals replica was done correctly + ProveReplicaUpdate1(ctx context.Context, sector SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (ReplicaVanillaProofs, error) + ProveReplicaUpdate2(ctx context.Context, sector SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs ReplicaVanillaProofs) (ReplicaUpdateProof, error) + + // GenerateSectorKeyFromData computes sector key given unsealed data and updated replica + GenerateSectorKeyFromData(ctx context.Context, sector SectorRef, unsealed cid.Cid) error + + FinalizeReplicaUpdate(ctx context.Context, sector SectorRef, keepUnsealed []Range) error } diff --git a/storage/sealer/storiface/worker.go b/storage/sealer/storiface/worker.go index e03c546ec..5d2781ec8 100644 --- a/storage/sealer/storiface/worker.go +++ b/storage/sealer/storiface/worker.go @@ -11,7 +11,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/sealtasks" ) @@ -119,22 +118,22 @@ var UndefCall CallID type WorkerCalls interface { // async - DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (CallID, error) - AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (CallID, error) - SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (CallID, error) - SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (CallID, error) - SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (CallID, error) - SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (CallID, error) - FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (CallID, error) - FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (CallID, error) - ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (CallID, error) - ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (CallID, error) - ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (CallID, error) - ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (CallID, error) - GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) (CallID, error) - MoveStorage(ctx context.Context, sector storage.SectorRef, types SectorFileType) (CallID, error) - UnsealPiece(context.Context, storage.SectorRef, UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (CallID, error) - Fetch(context.Context, storage.SectorRef, SectorFileType, PathType, AcquireMode) (CallID, error) + DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData Data) (CallID, error) + AddPiece(ctx context.Context, sector SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData Data) (CallID, error) + SealPreCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (CallID, error) + SealPreCommit2(ctx context.Context, sector SectorRef, pc1o PreCommit1Out) (CallID, error) + SealCommit1(ctx context.Context, sector SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids SectorCids) (CallID, error) + SealCommit2(ctx context.Context, sector SectorRef, c1o Commit1Out) (CallID, error) + FinalizeSector(ctx context.Context, sector SectorRef, keepUnsealed []Range) (CallID, error) + FinalizeReplicaUpdate(ctx context.Context, sector SectorRef, keepUnsealed []Range) (CallID, error) + ReleaseUnsealed(ctx context.Context, sector SectorRef, safeToFree []Range) (CallID, error) + ReplicaUpdate(ctx context.Context, sector SectorRef, pieces []abi.PieceInfo) (CallID, error) + ProveReplicaUpdate1(ctx context.Context, sector SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (CallID, error) + ProveReplicaUpdate2(ctx context.Context, sector SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs ReplicaVanillaProofs) (CallID, error) + GenerateSectorKeyFromData(ctx context.Context, sector SectorRef, commD cid.Cid) (CallID, error) + MoveStorage(ctx context.Context, sector SectorRef, types SectorFileType) (CallID, error) + UnsealPiece(context.Context, SectorRef, UnpaddedByteIndex, abi.UnpaddedPieceSize, abi.SealRandomness, cid.Cid) (CallID, error) + Fetch(context.Context, SectorRef, SectorFileType, PathType, AcquireMode) (CallID, error) // sync GenerateWinningPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, mid abi.ActorID, sectors []PostSectorChallenge, randomness abi.PoStRandomness) ([]proof.PoStProof, error) @@ -202,15 +201,15 @@ func Err(code ErrorCode, sub error) *CallError { type WorkerReturn interface { ReturnDataCid(ctx context.Context, callID CallID, pi abi.PieceInfo, err *CallError) error ReturnAddPiece(ctx context.Context, callID CallID, pi abi.PieceInfo, err *CallError) error - ReturnSealPreCommit1(ctx context.Context, callID CallID, p1o storage.PreCommit1Out, err *CallError) error - ReturnSealPreCommit2(ctx context.Context, callID CallID, sealed storage.SectorCids, err *CallError) error - ReturnSealCommit1(ctx context.Context, callID CallID, out storage.Commit1Out, err *CallError) error - ReturnSealCommit2(ctx context.Context, callID CallID, proof storage.Proof, err *CallError) error + ReturnSealPreCommit1(ctx context.Context, callID CallID, p1o PreCommit1Out, err *CallError) error + ReturnSealPreCommit2(ctx context.Context, callID CallID, sealed SectorCids, err *CallError) error + ReturnSealCommit1(ctx context.Context, callID CallID, out Commit1Out, err *CallError) error + ReturnSealCommit2(ctx context.Context, callID CallID, proof Proof, err *CallError) error ReturnFinalizeSector(ctx context.Context, callID CallID, err *CallError) error ReturnReleaseUnsealed(ctx context.Context, callID CallID, err *CallError) error - ReturnReplicaUpdate(ctx context.Context, callID CallID, out storage.ReplicaUpdateOut, err *CallError) error - ReturnProveReplicaUpdate1(ctx context.Context, callID CallID, proofs storage.ReplicaVanillaProofs, err *CallError) error - ReturnProveReplicaUpdate2(ctx context.Context, callID CallID, proof storage.ReplicaUpdateProof, err *CallError) error + ReturnReplicaUpdate(ctx context.Context, callID CallID, out ReplicaUpdateOut, err *CallError) error + ReturnProveReplicaUpdate1(ctx context.Context, callID CallID, proofs ReplicaVanillaProofs, err *CallError) error + ReturnProveReplicaUpdate2(ctx context.Context, callID CallID, proof ReplicaUpdateProof, err *CallError) error ReturnGenerateSectorKeyFromData(ctx context.Context, callID CallID, err *CallError) error ReturnFinalizeReplicaUpdate(ctx context.Context, callID CallID, err *CallError) error ReturnMoveStorage(ctx context.Context, callID CallID, err *CallError) error diff --git a/storage/sealer/teststorage_test.go b/storage/sealer/teststorage_test.go index e1e59c0b0..9fbe1bd6b 100644 --- a/storage/sealer/teststorage_test.go +++ b/storage/sealer/teststorage_test.go @@ -8,7 +8,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" "github.com/filecoin-project/lotus/storage/sealer/storiface" @@ -23,7 +22,7 @@ type testExec struct { apch chan chan apres } -func (t *testExec) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) { +func (t *testExec) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) { panic("implement me") } @@ -43,82 +42,82 @@ func (t *testExec) GenerateWindowPoStWithVanilla(ctx context.Context, proofType panic("implement me") } -func (t *testExec) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storage.PreCommit1Out, error) { +func (t *testExec) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.PreCommit1Out, error) { panic("implement me") } -func (t *testExec) SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (storage.SectorCids, error) { +func (t *testExec) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.SectorCids, error) { panic("implement me") } -func (t *testExec) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storage.Commit1Out, error) { +func (t *testExec) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.Commit1Out, error) { panic("implement me") } -func (t *testExec) SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (storage.Proof, error) { +func (t *testExec) SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.Proof, error) { panic("implement me") } -func (t *testExec) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { +func (t *testExec) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { panic("implement me") } -func (t *testExec) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) error { +func (t *testExec) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) error { panic("implement me") } -func (t *testExec) ReleaseSealed(ctx context.Context, sector storage.SectorRef) error { +func (t *testExec) ReleaseSealed(ctx context.Context, sector storiface.SectorRef) error { panic("implement me") } -func (t *testExec) ReleaseSectorKey(ctx context.Context, sector storage.SectorRef) error { +func (t *testExec) ReleaseSectorKey(ctx context.Context, sector storiface.SectorRef) error { panic("implement me") } -func (t *testExec) ReleaseReplicaUpgrade(ctx context.Context, sector storage.SectorRef) error { +func (t *testExec) ReleaseReplicaUpgrade(ctx context.Context, sector storiface.SectorRef) error { panic("implement me") } -func (t *testExec) Remove(ctx context.Context, sector storage.SectorRef) error { +func (t *testExec) Remove(ctx context.Context, sector storiface.SectorRef) error { panic("implement me") } -func (t *testExec) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storage.ReplicaUpdateOut, error) { +func (t *testExec) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.ReplicaUpdateOut, error) { panic("implement me") } -func (t *testExec) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storage.ReplicaVanillaProofs, error) { +func (t *testExec) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.ReplicaVanillaProofs, error) { panic("implement me") } -func (t *testExec) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storage.ReplicaUpdateProof, error) { +func (t *testExec) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.ReplicaUpdateProof, error) { panic("implement me") } -func (t *testExec) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) error { +func (t *testExec) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) error { panic("implement me") } -func (t *testExec) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) error { +func (t *testExec) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) error { panic("implement me") } -func (t *testExec) NewSector(ctx context.Context, sector storage.SectorRef) error { +func (t *testExec) NewSector(ctx context.Context, sector storiface.SectorRef) error { panic("implement me") } -func (t *testExec) AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (abi.PieceInfo, error) { +func (t *testExec) AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (abi.PieceInfo, error) { resp := make(chan apres) t.apch <- resp ar := <-resp return ar.pi, ar.err } -func (t *testExec) UnsealPiece(ctx context.Context, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error { +func (t *testExec) UnsealPiece(ctx context.Context, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, commd cid.Cid) error { panic("implement me") } -func (t *testExec) ReadPiece(ctx context.Context, writer io.Writer, sector storage.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) { +func (t *testExec) ReadPiece(ctx context.Context, writer io.Writer, sector storiface.SectorRef, offset storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize) (bool, error) { panic("implement me") } diff --git a/storage/sealer/testworker_test.go b/storage/sealer/testworker_test.go index 35169b845..6ea57b78d 100644 --- a/storage/sealer/testworker_test.go +++ b/storage/sealer/testworker_test.go @@ -8,7 +8,6 @@ import ( "github.com/ipfs/go-cid" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/sealer/mock" @@ -49,7 +48,7 @@ func newTestWorker(wcfg WorkerConfig, lstor *paths.Local, ret storiface.WorkerRe } } -func (t *testWorker) asyncCall(sector storage.SectorRef, work func(ci storiface.CallID)) (storiface.CallID, error) { +func (t *testWorker) asyncCall(sector storiface.SectorRef, work func(ci storiface.CallID)) (storiface.CallID, error) { ci := storiface.CallID{ Sector: sector.ID, ID: uuid.New(), @@ -60,7 +59,7 @@ func (t *testWorker) asyncCall(sector storage.SectorRef, work func(ci storiface. return ci, nil } -func (t *testWorker) AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) { +func (t *testWorker) AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) { return t.asyncCall(sector, func(ci storiface.CallID) { p, err := t.mockSeal.AddPiece(ctx, sector, pieceSizes, newPieceSize, pieceData) if err := t.ret.ReturnAddPiece(ctx, ci, p, toCallError(err)); err != nil { @@ -69,7 +68,7 @@ func (t *testWorker) AddPiece(ctx context.Context, sector storage.SectorRef, pie }) } -func (t *testWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) { +func (t *testWorker) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) { return t.asyncCall(sector, func(ci storiface.CallID) { out, err := t.mockSeal.ReplicaUpdate(ctx, sector, pieces) if err := t.ret.ReturnReplicaUpdate(ctx, ci, out, toCallError(err)); err != nil { @@ -78,7 +77,7 @@ func (t *testWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRef }) } -func (t *testWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) { +func (t *testWorker) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) { return t.asyncCall(sector, func(ci storiface.CallID) { vanillaProofs, err := t.mockSeal.ProveReplicaUpdate1(ctx, sector, sectorKey, newSealed, newUnsealed) if err := t.ret.ReturnProveReplicaUpdate1(ctx, ci, vanillaProofs, toCallError(err)); err != nil { @@ -87,7 +86,7 @@ func (t *testWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.Sec }) } -func (t *testWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storiface.CallID, error) { +func (t *testWorker) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) { return t.asyncCall(sector, func(ci storiface.CallID) { proof, err := t.mockSeal.ProveReplicaUpdate2(ctx, sector, sectorKey, newSealed, newUnsealed, vanillaProofs) if err := t.ret.ReturnProveReplicaUpdate2(ctx, ci, proof, toCallError(err)); err != nil { @@ -96,7 +95,7 @@ func (t *testWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.Sec }) } -func (t *testWorker) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) { +func (t *testWorker) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) { return t.asyncCall(sector, func(ci storiface.CallID) { t.pc1s++ @@ -114,7 +113,7 @@ func (t *testWorker) SealPreCommit1(ctx context.Context, sector storage.SectorRe }) } -func (t *testWorker) Fetch(ctx context.Context, sector storage.SectorRef, fileType storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) { +func (t *testWorker) Fetch(ctx context.Context, sector storiface.SectorRef, fileType storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) { return t.asyncCall(sector, func(ci storiface.CallID) { if err := t.ret.ReturnFetch(ctx, ci, nil); err != nil { log.Error(err) diff --git a/storage/sealer/worker_local.go b/storage/sealer/worker_local.go index b2691b6dd..f2a2f5cc1 100644 --- a/storage/sealer/worker_local.go +++ b/storage/sealer/worker_local.go @@ -21,7 +21,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-statestore" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/storage/paths" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" @@ -144,7 +143,7 @@ type localWorkerPathProvider struct { op storiface.AcquireMode } -func (l *localWorkerPathProvider) AcquireSector(ctx context.Context, sector storage.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType) (storiface.SectorPaths, func(), error) { +func (l *localWorkerPathProvider) AcquireSector(ctx context.Context, sector storiface.SectorRef, existing storiface.SectorFileType, allocate storiface.SectorFileType, sealing storiface.PathType) (storiface.SectorPaths, func(), error) { paths, storageIDs, err := l.w.storage.AcquireSector(ctx, sector, existing, allocate, sealing, l.op) if err != nil { return storiface.SectorPaths{}, nil, err @@ -251,7 +250,7 @@ var returnFunc = map[ReturnType]func(context.Context, storiface.CallID, storifac Fetch: rfunc(storiface.WorkerReturn.ReturnFetch), } -func (l *LocalWorker) asyncCall(ctx context.Context, sector storage.SectorRef, rt ReturnType, work func(ctx context.Context, ci storiface.CallID) (interface{}, error)) (storiface.CallID, error) { +func (l *LocalWorker) asyncCall(ctx context.Context, sector storiface.SectorRef, rt ReturnType, work func(ctx context.Context, ci storiface.CallID) (interface{}, error)) (storiface.CallID, error) { ci := storiface.CallID{ Sector: sector.ID, ID: uuid.New(), @@ -334,7 +333,7 @@ func doReturn(ctx context.Context, rt ReturnType, ci storiface.CallID, ret stori return true } -func (l *LocalWorker) NewSector(ctx context.Context, sector storage.SectorRef) error { +func (l *LocalWorker) NewSector(ctx context.Context, sector storiface.SectorRef) error { sb, err := l.executor() if err != nil { return err @@ -343,18 +342,18 @@ func (l *LocalWorker) NewSector(ctx context.Context, sector storage.SectorRef) e return sb.NewSector(ctx, sector) } -func (l *LocalWorker) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) { +func (l *LocalWorker) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err } - return l.asyncCall(ctx, storage.NoSectorRef, DataCid, func(ctx context.Context, ci storiface.CallID) (interface{}, error) { + return l.asyncCall(ctx, storiface.NoSectorRef, DataCid, func(ctx context.Context, ci storiface.CallID) (interface{}, error) { return sb.DataCid(ctx, pieceSize, pieceData) }) } -func (l *LocalWorker) AddPiece(ctx context.Context, sector storage.SectorRef, epcs []abi.UnpaddedPieceSize, sz abi.UnpaddedPieceSize, r io.Reader) (storiface.CallID, error) { +func (l *LocalWorker) AddPiece(ctx context.Context, sector storiface.SectorRef, epcs []abi.UnpaddedPieceSize, sz abi.UnpaddedPieceSize, r io.Reader) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -365,7 +364,7 @@ func (l *LocalWorker) AddPiece(ctx context.Context, sector storage.SectorRef, ep }) } -func (l *LocalWorker) Fetch(ctx context.Context, sector storage.SectorRef, fileType storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) { +func (l *LocalWorker) Fetch(ctx context.Context, sector storiface.SectorRef, fileType storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) { return l.asyncCall(ctx, sector, Fetch, func(ctx context.Context, ci storiface.CallID) (interface{}, error) { _, done, err := (&localWorkerPathProvider{w: l, op: am}).AcquireSector(ctx, sector, fileType, storiface.FTNone, ptype) if err == nil { @@ -376,7 +375,7 @@ func (l *LocalWorker) Fetch(ctx context.Context, sector storage.SectorRef, fileT }) } -func (l *LocalWorker) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) { +func (l *LocalWorker) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) { return l.asyncCall(ctx, sector, SealPreCommit1, func(ctx context.Context, ci storiface.CallID) (interface{}, error) { { @@ -399,7 +398,7 @@ func (l *LocalWorker) SealPreCommit1(ctx context.Context, sector storage.SectorR }) } -func (l *LocalWorker) SealPreCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.PreCommit1Out) (storiface.CallID, error) { +func (l *LocalWorker) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.PreCommit1Out) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -410,7 +409,7 @@ func (l *LocalWorker) SealPreCommit2(ctx context.Context, sector storage.SectorR }) } -func (l *LocalWorker) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storiface.CallID, error) { +func (l *LocalWorker) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -421,7 +420,7 @@ func (l *LocalWorker) SealCommit1(ctx context.Context, sector storage.SectorRef, }) } -func (l *LocalWorker) SealCommit2(ctx context.Context, sector storage.SectorRef, phase1Out storage.Commit1Out) (storiface.CallID, error) { +func (l *LocalWorker) SealCommit2(ctx context.Context, sector storiface.SectorRef, phase1Out storiface.Commit1Out) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -432,7 +431,7 @@ func (l *LocalWorker) SealCommit2(ctx context.Context, sector storage.SectorRef, }) } -func (l *LocalWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) { +func (l *LocalWorker) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -444,7 +443,7 @@ func (l *LocalWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRe }) } -func (l *LocalWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) { +func (l *LocalWorker) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -455,7 +454,7 @@ func (l *LocalWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.Se }) } -func (l *LocalWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storiface.CallID, error) { +func (l *LocalWorker) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -466,7 +465,7 @@ func (l *LocalWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.Se }) } -func (l *LocalWorker) GenerateSectorKeyFromData(ctx context.Context, sector storage.SectorRef, commD cid.Cid) (storiface.CallID, error) { +func (l *LocalWorker) GenerateSectorKeyFromData(ctx context.Context, sector storiface.SectorRef, commD cid.Cid) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -477,7 +476,7 @@ func (l *LocalWorker) GenerateSectorKeyFromData(ctx context.Context, sector stor }) } -func (l *LocalWorker) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) { +func (l *LocalWorker) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -498,7 +497,7 @@ func (l *LocalWorker) FinalizeSector(ctx context.Context, sector storage.SectorR }) } -func (l *LocalWorker) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) { +func (l *LocalWorker) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err @@ -519,7 +518,7 @@ func (l *LocalWorker) FinalizeReplicaUpdate(ctx context.Context, sector storage. }) } -func (l *LocalWorker) ReleaseUnsealed(ctx context.Context, sector storage.SectorRef, safeToFree []storage.Range) (storiface.CallID, error) { +func (l *LocalWorker) ReleaseUnsealed(ctx context.Context, sector storiface.SectorRef, safeToFree []storiface.Range) (storiface.CallID, error) { return storiface.UndefCall, xerrors.Errorf("implement me") } @@ -539,7 +538,7 @@ func (l *LocalWorker) Remove(ctx context.Context, sector abi.SectorID) error { return err } -func (l *LocalWorker) MoveStorage(ctx context.Context, sector storage.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) { +func (l *LocalWorker) MoveStorage(ctx context.Context, sector storiface.SectorRef, types storiface.SectorFileType) (storiface.CallID, error) { return l.asyncCall(ctx, sector, MoveStorage, func(ctx context.Context, ci storiface.CallID) (interface{}, error) { if err := l.storage.MoveStorage(ctx, sector, types); err != nil { return nil, xerrors.Errorf("move to storage: %w", err) @@ -558,7 +557,7 @@ func (l *LocalWorker) MoveStorage(ctx context.Context, sector storage.SectorRef, }) } -func (l *LocalWorker) UnsealPiece(ctx context.Context, sector storage.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, cid cid.Cid) (storiface.CallID, error) { +func (l *LocalWorker) UnsealPiece(ctx context.Context, sector storiface.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, cid cid.Cid) (storiface.CallID, error) { sb, err := l.executor() if err != nil { return storiface.UndefCall, err diff --git a/storage/sealer/worker_tracked.go b/storage/sealer/worker_tracked.go index e051b1454..970ba9a69 100644 --- a/storage/sealer/worker_tracked.go +++ b/storage/sealer/worker_tracked.go @@ -11,7 +11,6 @@ import ( "go.opencensus.io/tag" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/storage/sealer/sealtasks" @@ -58,7 +57,7 @@ func (wt *workTracker) onDone(ctx context.Context, callID storiface.CallID) { delete(wt.running, callID) } -func (wt *workTracker) track(ctx context.Context, ready chan struct{}, wid storiface.WorkerID, wi storiface.WorkerInfo, sid storage.SectorRef, task sealtasks.TaskType, cb func() (storiface.CallID, error)) (storiface.CallID, error) { +func (wt *workTracker) track(ctx context.Context, ready chan struct{}, wid storiface.WorkerID, wi storiface.WorkerInfo, sid storiface.SectorRef, task sealtasks.TaskType, cb func() (storiface.CallID, error)) (storiface.CallID, error) { tracked := func(rw int, callID storiface.CallID) trackedWork { return trackedWork{ job: storiface.WorkerJob{ @@ -166,67 +165,67 @@ func (t *trackedWorker) start() { close(t.execute) } -func (t *trackedWorker) SealPreCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) { +func (t *trackedWorker) SealPreCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, pieces []abi.PieceInfo) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTPreCommit1, func() (storiface.CallID, error) { return t.Worker.SealPreCommit1(ctx, sector, ticket, pieces) }) } -func (t *trackedWorker) SealPreCommit2(ctx context.Context, sector storage.SectorRef, pc1o storage.PreCommit1Out) (storiface.CallID, error) { +func (t *trackedWorker) SealPreCommit2(ctx context.Context, sector storiface.SectorRef, pc1o storiface.PreCommit1Out) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTPreCommit2, func() (storiface.CallID, error) { return t.Worker.SealPreCommit2(ctx, sector, pc1o) }) } -func (t *trackedWorker) SealCommit1(ctx context.Context, sector storage.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storage.SectorCids) (storiface.CallID, error) { +func (t *trackedWorker) SealCommit1(ctx context.Context, sector storiface.SectorRef, ticket abi.SealRandomness, seed abi.InteractiveSealRandomness, pieces []abi.PieceInfo, cids storiface.SectorCids) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTCommit1, func() (storiface.CallID, error) { return t.Worker.SealCommit1(ctx, sector, ticket, seed, pieces, cids) }) } -func (t *trackedWorker) SealCommit2(ctx context.Context, sector storage.SectorRef, c1o storage.Commit1Out) (storiface.CallID, error) { +func (t *trackedWorker) SealCommit2(ctx context.Context, sector storiface.SectorRef, c1o storiface.Commit1Out) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTCommit2, func() (storiface.CallID, error) { return t.Worker.SealCommit2(ctx, sector, c1o) }) } -func (t *trackedWorker) FinalizeSector(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) { +func (t *trackedWorker) FinalizeSector(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTFinalize, func() (storiface.CallID, error) { return t.Worker.FinalizeSector(ctx, sector, keepUnsealed) }) } -func (t *trackedWorker) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) { - return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, storage.NoSectorRef, sealtasks.TTDataCid, func() (storiface.CallID, error) { +func (t *trackedWorker) DataCid(ctx context.Context, pieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) { + return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, storiface.NoSectorRef, sealtasks.TTDataCid, func() (storiface.CallID, error) { return t.Worker.DataCid(ctx, pieceSize, pieceData) }) } -func (t *trackedWorker) AddPiece(ctx context.Context, sector storage.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storage.Data) (storiface.CallID, error) { +func (t *trackedWorker) AddPiece(ctx context.Context, sector storiface.SectorRef, pieceSizes []abi.UnpaddedPieceSize, newPieceSize abi.UnpaddedPieceSize, pieceData storiface.Data) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTAddPiece, func() (storiface.CallID, error) { return t.Worker.AddPiece(ctx, sector, pieceSizes, newPieceSize, pieceData) }) } -func (t *trackedWorker) Fetch(ctx context.Context, s storage.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) { +func (t *trackedWorker) Fetch(ctx context.Context, s storiface.SectorRef, ft storiface.SectorFileType, ptype storiface.PathType, am storiface.AcquireMode) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, s, sealtasks.TTFetch, func() (storiface.CallID, error) { return t.Worker.Fetch(ctx, s, ft, ptype, am) }) } -func (t *trackedWorker) UnsealPiece(ctx context.Context, id storage.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, cid cid.Cid) (storiface.CallID, error) { +func (t *trackedWorker) UnsealPiece(ctx context.Context, id storiface.SectorRef, index storiface.UnpaddedByteIndex, size abi.UnpaddedPieceSize, randomness abi.SealRandomness, cid cid.Cid) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, id, sealtasks.TTUnseal, func() (storiface.CallID, error) { return t.Worker.UnsealPiece(ctx, id, index, size, randomness, cid) }) } -func (t *trackedWorker) ReplicaUpdate(ctx context.Context, sector storage.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) { +func (t *trackedWorker) ReplicaUpdate(ctx context.Context, sector storiface.SectorRef, pieces []abi.PieceInfo) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTReplicaUpdate, func() (storiface.CallID, error) { return t.Worker.ReplicaUpdate(ctx, sector, pieces) }) } -func (t *trackedWorker) ProveReplicaUpdate1(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) { +func (t *trackedWorker) ProveReplicaUpdate1(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTProveReplicaUpdate1, func() (storiface.CallID, error) { return t.Worker.ProveReplicaUpdate1(ctx, sector, sectorKey, newSealed, newUnsealed) }) } -func (t *trackedWorker) ProveReplicaUpdate2(ctx context.Context, sector storage.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storage.ReplicaVanillaProofs) (storiface.CallID, error) { +func (t *trackedWorker) ProveReplicaUpdate2(ctx context.Context, sector storiface.SectorRef, sectorKey, newSealed, newUnsealed cid.Cid, vanillaProofs storiface.ReplicaVanillaProofs) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTProveReplicaUpdate2, func() (storiface.CallID, error) { return t.Worker.ProveReplicaUpdate2(ctx, sector, sectorKey, newSealed, newUnsealed, vanillaProofs) }) } -func (t *trackedWorker) FinalizeReplicaUpdate(ctx context.Context, sector storage.SectorRef, keepUnsealed []storage.Range) (storiface.CallID, error) { +func (t *trackedWorker) FinalizeReplicaUpdate(ctx context.Context, sector storiface.SectorRef, keepUnsealed []storiface.Range) (storiface.CallID, error) { return t.tracker.track(ctx, t.execute, t.wid, t.workerInfo, sector, sealtasks.TTFinalizeReplicaUpdate, func() (storiface.CallID, error) { return t.Worker.FinalizeReplicaUpdate(ctx, sector, keepUnsealed) }) } diff --git a/storage/sectorblocks/blocks.go b/storage/sectorblocks/blocks.go index 231809a9f..efaf3ebbe 100644 --- a/storage/sectorblocks/blocks.go +++ b/storage/sectorblocks/blocks.go @@ -16,10 +16,10 @@ import ( cborutil "github.com/filecoin-project/go-cbor-util" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/node/modules/dtypes" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) type SealSerialization uint8 @@ -48,7 +48,7 @@ func DsKeyToDealID(key datastore.Key) (uint64, error) { } type SectorBuilder interface { - SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storage.Data, d api.PieceDealInfo) (api.SectorOffset, error) + SectorAddPieceToAny(ctx context.Context, size abi.UnpaddedPieceSize, r storiface.Data, d api.PieceDealInfo) (api.SectorOffset, error) SectorsStatus(ctx context.Context, sid abi.SectorNumber, showOnChainInfo bool) (api.SectorInfo, error) } diff --git a/storage/wdpost/wdpost_run.go b/storage/wdpost/wdpost_run.go index 5f3154151..d77181f4b 100644 --- a/storage/wdpost/wdpost_run.go +++ b/storage/wdpost/wdpost_run.go @@ -20,7 +20,6 @@ import ( "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/proof" proof7 "github.com/filecoin-project/specs-actors/v7/actors/runtime/proof" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -28,6 +27,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/messagepool" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) // recordPoStFailure records a failure in the journal. @@ -202,13 +202,13 @@ func (s *WindowPoStScheduler) checkSectors(ctx context.Context, check bitfield.B } sectors := make(map[abi.SectorNumber]checkSector) - var tocheck []storage.SectorRef + var tocheck []storiface.SectorRef for _, info := range sectorInfos { sectors[info.SectorNumber] = checkSector{ sealed: info.SealedCID, update: info.SectorKeyCID != nil, } - tocheck = append(tocheck, storage.SectorRef{ + tocheck = append(tocheck, storiface.SectorRef{ ProofType: info.SealProof, ID: abi.SectorID{ Miner: abi.ActorID(mid), diff --git a/storage/wdpost/wdpost_run_test.go b/storage/wdpost/wdpost_run_test.go index db3e535dd..a7846b32b 100644 --- a/storage/wdpost/wdpost_run_test.go +++ b/storage/wdpost/wdpost_run_test.go @@ -21,7 +21,6 @@ import ( "github.com/filecoin-project/go-state-types/network" prooftypes "github.com/filecoin-project/go-state-types/proof" tutils "github.com/filecoin-project/specs-actors/v2/support/testing" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -173,7 +172,7 @@ func (m mockVerif) GenerateWinningPoStSectorChallenge(context.Context, abi.Regis type mockFaultTracker struct { } -func (m mockFaultTracker) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) { +func (m mockFaultTracker) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storiface.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) { // Returns "bad" sectors so just return empty map meaning all sectors are good return map[abi.SectorID]string{}, nil } diff --git a/storage/wdpost/wdpost_sched.go b/storage/wdpost/wdpost_sched.go index 99f14c691..65cc8ba45 100644 --- a/storage/wdpost/wdpost_sched.go +++ b/storage/wdpost/wdpost_sched.go @@ -16,7 +16,6 @@ import ( "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/network" - "github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" @@ -27,6 +26,7 @@ import ( "github.com/filecoin-project/lotus/storage/ctladdr" "github.com/filecoin-project/lotus/storage/sealer" "github.com/filecoin-project/lotus/storage/sealer/ffiwrapper" + "github.com/filecoin-project/lotus/storage/sealer/storiface" ) var log = logging.Logger("wdpost") @@ -66,7 +66,7 @@ type WindowPoStScheduler struct { api NodeAPI feeCfg config.MinerFeeConfig addrSel *ctladdr.AddressSelector - prover storage.Prover + prover storiface.Prover verifier ffiwrapper.Verifier faultTracker sealer.FaultTracker proofType abi.RegisteredPoStProof @@ -86,7 +86,7 @@ type WindowPoStScheduler struct { func NewWindowedPoStScheduler(api NodeAPI, cfg config.MinerFeeConfig, as *ctladdr.AddressSelector, - sp storage.Prover, + sp storiface.Prover, verif ffiwrapper.Verifier, ft sealer.FaultTracker, j journal.Journal,