fix tests, expand interfaces a little

This commit is contained in:
whyrusleeping 2020-01-09 10:28:14 -08:00
parent cc56389dbb
commit 5e16aab51b
4 changed files with 27 additions and 3 deletions

View File

@ -3,12 +3,13 @@ package impl
import (
"context"
"encoding/json"
"github.com/filecoin-project/lotus/api/apistruct"
"io"
"mime"
"net/http"
"os"
"github.com/filecoin-project/lotus/api/apistruct"
"github.com/gorilla/mux"
files "github.com/ipfs/go-ipfs-files"
@ -25,7 +26,7 @@ type StorageMinerAPI struct {
CommonAPI
SectorBuilderConfig *sectorbuilder.Config
SectorBuilder *sectorbuilder.SectorBuilder
SectorBuilder storage.SectorBuilder
SectorBlocks *sectorblocks.SectorBlocks
Miner *storage.Miner

View File

@ -236,7 +236,7 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
t.Fatal(err)
}
if err := sma.SectorBuilder.ImportFrom(osb, false); err != nil {
if err := sma.SectorBuilder.(*sectorbuilder.SectorBuilder).ImportFrom(osb, false); err != nil {
t.Fatal(err)
}

View File

@ -81,6 +81,12 @@ type SectorBuilder interface {
GenerateFallbackPoSt(sectorbuilder.SortedPublicSectorInfo, [sectorbuilder.CommLen]byte, []uint64) ([]sectorbuilder.EPostCandidate, []byte, error)
SealPreCommit(uint64, sectorbuilder.SealTicket, []sectorbuilder.PublicPieceInfo) (sectorbuilder.RawSealPreCommitOutput, error)
SealCommit(uint64, sectorbuilder.SealTicket, sectorbuilder.SealSeed, []sectorbuilder.PublicPieceInfo, sectorbuilder.RawSealPreCommitOutput) ([]byte, error)
// Not so sure about these being on the interface
GetPath(string, string) (string, error)
WorkerStats() sectorbuilder.WorkerStats
AddWorker(context.Context, sectorbuilder.WorkerCfg) (<-chan sectorbuilder.WorkerTask, error)
TaskDone(context.Context, uint64, sectorbuilder.SealRes) error
}
func NewMiner(api storageMinerApi, addr address.Address, h host.Host, ds datastore.Batching, sb SectorBuilder, tktFn TicketFn) (*Miner, error) {

View File

@ -1,6 +1,7 @@
package sbmock
import (
"context"
"io"
"io/ioutil"
"math/rand"
@ -119,3 +120,19 @@ func (sb *SBMock) SealCommit(sid uint64, ticket sectorbuilder.SealTicket, seed s
rand.Read(buf)
return buf, nil
}
func (sb *SBMock) GetPath(string, string) (string, error) {
panic("nyi")
}
func (sb *SBMock) WorkerStats() sectorbuilder.WorkerStats {
panic("nyi")
}
func (sb *SBMock) AddWorker(context.Context, sectorbuilder.WorkerCfg) (<-chan sectorbuilder.WorkerTask, error) {
panic("nyi")
}
func (sb *SBMock) TaskDone(context.Context, uint64, sectorbuilder.SealRes) error {
panic("nyi")
}