fix tests, expand interfaces a little
This commit is contained in:
parent
cc56389dbb
commit
5e16aab51b
@ -3,12 +3,13 @@ package impl
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"github.com/filecoin-project/lotus/api/apistruct"
|
|
||||||
"io"
|
"io"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/apistruct"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
files "github.com/ipfs/go-ipfs-files"
|
files "github.com/ipfs/go-ipfs-files"
|
||||||
|
|
||||||
@ -25,7 +26,7 @@ type StorageMinerAPI struct {
|
|||||||
CommonAPI
|
CommonAPI
|
||||||
|
|
||||||
SectorBuilderConfig *sectorbuilder.Config
|
SectorBuilderConfig *sectorbuilder.Config
|
||||||
SectorBuilder *sectorbuilder.SectorBuilder
|
SectorBuilder storage.SectorBuilder
|
||||||
SectorBlocks *sectorblocks.SectorBlocks
|
SectorBlocks *sectorblocks.SectorBlocks
|
||||||
|
|
||||||
Miner *storage.Miner
|
Miner *storage.Miner
|
||||||
|
@ -236,7 +236,7 @@ func builder(t *testing.T, nFull int, storage []int) ([]test.TestNode, []test.Te
|
|||||||
t.Fatal(err)
|
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)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,6 +81,12 @@ type SectorBuilder interface {
|
|||||||
GenerateFallbackPoSt(sectorbuilder.SortedPublicSectorInfo, [sectorbuilder.CommLen]byte, []uint64) ([]sectorbuilder.EPostCandidate, []byte, error)
|
GenerateFallbackPoSt(sectorbuilder.SortedPublicSectorInfo, [sectorbuilder.CommLen]byte, []uint64) ([]sectorbuilder.EPostCandidate, []byte, error)
|
||||||
SealPreCommit(uint64, sectorbuilder.SealTicket, []sectorbuilder.PublicPieceInfo) (sectorbuilder.RawSealPreCommitOutput, error)
|
SealPreCommit(uint64, sectorbuilder.SealTicket, []sectorbuilder.PublicPieceInfo) (sectorbuilder.RawSealPreCommitOutput, error)
|
||||||
SealCommit(uint64, sectorbuilder.SealTicket, sectorbuilder.SealSeed, []sectorbuilder.PublicPieceInfo, sectorbuilder.RawSealPreCommitOutput) ([]byte, 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) {
|
func NewMiner(api storageMinerApi, addr address.Address, h host.Host, ds datastore.Batching, sb SectorBuilder, tktFn TicketFn) (*Miner, error) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package sbmock
|
package sbmock
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -119,3 +120,19 @@ func (sb *SBMock) SealCommit(sid uint64, ticket sectorbuilder.SealTicket, seed s
|
|||||||
rand.Read(buf)
|
rand.Read(buf)
|
||||||
return buf, nil
|
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")
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user