diff --git a/extern/sector-storage/faults.go b/extern/sector-storage/faults.go index 0fd385250..fdd5f6b7d 100644 --- a/extern/sector-storage/faults.go +++ b/extern/sector-storage/faults.go @@ -9,8 +9,6 @@ import ( "golang.org/x/xerrors" - "github.com/ipfs/go-cid" - ffi "github.com/filecoin-project/filecoin-ffi" "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/specs-actors/actors/runtime/proof" @@ -21,13 +19,11 @@ import ( // FaultTracker TODO: Track things more actively type FaultTracker interface { - CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg RGetter) (map[abi.SectorID]string, error) + CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) } -type RGetter func(ctx context.Context, id abi.SectorID) (cid.Cid, error) - // CheckProvable returns unprovable sectors -func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg RGetter) (map[abi.SectorID]string, error) { +func (m *Manager) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) { var bad = make(map[abi.SectorID]string) ssize, err := pp.SectorSize() diff --git a/extern/sector-storage/mock/mock.go b/extern/sector-storage/mock/mock.go index 59d7d0503..47fb2b974 100644 --- a/extern/sector-storage/mock/mock.go +++ b/extern/sector-storage/mock/mock.go @@ -405,7 +405,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) (map[abi.SectorID]string, error) { +func (mgr *SectorMgr) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, ids []storage.SectorRef, rg storiface.RGetter) (map[abi.SectorID]string, error) { bad := map[abi.SectorID]string{} for _, sid := range ids { diff --git a/extern/sector-storage/storiface/ffi.go b/extern/sector-storage/storiface/ffi.go index 95d400e52..31d5b2be5 100644 --- a/extern/sector-storage/storiface/ffi.go +++ b/extern/sector-storage/storiface/ffi.go @@ -1,7 +1,9 @@ package storiface import ( + "context" "errors" + "github.com/ipfs/go-cid" "github.com/filecoin-project/go-state-types/abi" ) @@ -15,3 +17,5 @@ func (i UnpaddedByteIndex) Padded() PaddedByteIndex { } type PaddedByteIndex uint64 + +type RGetter func(ctx context.Context, id abi.SectorID) (cid.Cid, error) diff --git a/node/impl/storminer.go b/node/impl/storminer.go index 79dd898d0..a1a6bec24 100644 --- a/node/impl/storminer.go +++ b/node/impl/storminer.go @@ -545,7 +545,7 @@ func (sm *StorageMinerAPI) CreateBackup(ctx context.Context, fpath string) error } func (sm *StorageMinerAPI) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []sto.SectorRef, expensive bool) (map[abi.SectorNumber]string, error) { - var rg sectorstorage.RGetter + var rg storiface.RGetter if expensive { rg = func(ctx context.Context, id abi.SectorID) (cid.Cid, error) { si, err := sm.Miner.GetSectorInfo(id.Number) diff --git a/storage/wdpost_run_test.go b/storage/wdpost_run_test.go index 80b4f66af..65b6b0183 100644 --- a/storage/wdpost_run_test.go +++ b/storage/wdpost_run_test.go @@ -27,6 +27,7 @@ import ( "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/lotus/extern/sector-storage/storiface" "github.com/filecoin-project/lotus/journal" ) @@ -125,7 +126,7 @@ func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, si type mockFaultTracker struct { } -func (m mockFaultTracker) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.SectorRef) (map[abi.SectorID]string, error) { +func (m mockFaultTracker) CheckProvable(ctx context.Context, pp abi.RegisteredPoStProof, sectors []storage.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 }