make storage miner acccept an interface to the sectorbuilder
This commit is contained in:
parent
b7e35ae3ed
commit
d08898ef37
@ -238,7 +238,7 @@ func Online() Option {
|
|||||||
|
|
||||||
// Storage miner
|
// Storage miner
|
||||||
ApplyIf(func(s *Settings) bool { return s.nodeType == repo.StorageMiner },
|
ApplyIf(func(s *Settings) bool { return s.nodeType == repo.StorageMiner },
|
||||||
Override(new(*sectorbuilder.SectorBuilder), modules.SectorBuilder),
|
Override(new(storage.SectorBuilder), modules.SectorBuilder),
|
||||||
Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks),
|
Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks),
|
||||||
Override(new(storage.TicketFn), modules.SealTicketGen),
|
Override(new(storage.TicketFn), modules.SealTicketGen),
|
||||||
Override(new(*storage.Miner), modules.StorageMiner),
|
Override(new(*storage.Miner), modules.StorageMiner),
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
|
|
||||||
"go.opencensus.io/trace"
|
"go.opencensus.io/trace"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -20,7 +19,7 @@ const StartConfidence = 4 // TODO: config
|
|||||||
|
|
||||||
type fpostScheduler struct {
|
type fpostScheduler struct {
|
||||||
api storageMinerApi
|
api storageMinerApi
|
||||||
sb *sectorbuilder.SectorBuilder
|
sb SectorBuilder
|
||||||
|
|
||||||
actor address.Address
|
actor address.Address
|
||||||
worker address.Address
|
worker address.Address
|
||||||
|
@ -3,6 +3,7 @@ package storage
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
|
"io"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -36,7 +37,7 @@ type Miner struct {
|
|||||||
worker address.Address
|
worker address.Address
|
||||||
|
|
||||||
// Sealing
|
// Sealing
|
||||||
sb *sectorbuilder.SectorBuilder
|
sb SectorBuilder
|
||||||
sectors *statestore.StateStore
|
sectors *statestore.StateStore
|
||||||
tktFn TicketFn
|
tktFn TicketFn
|
||||||
|
|
||||||
@ -71,7 +72,18 @@ type storageMinerApi interface {
|
|||||||
WalletHas(context.Context, address.Address) (bool, error)
|
WalletHas(context.Context, address.Address) (bool, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMiner(api storageMinerApi, addr address.Address, h host.Host, ds datastore.Batching, sb *sectorbuilder.SectorBuilder, tktFn TicketFn) (*Miner, error) {
|
type SectorBuilder interface {
|
||||||
|
RateLimit() func()
|
||||||
|
AddPiece(uint64, uint64, io.Reader, []uint64) (sectorbuilder.PublicPieceInfo, error)
|
||||||
|
SectorSize() uint64
|
||||||
|
AcquireSectorId() (uint64, error)
|
||||||
|
Scrub(sectorbuilder.SortedPublicSectorInfo) []*sectorbuilder.Fault
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewMiner(api storageMinerApi, addr address.Address, h host.Host, ds datastore.Batching, sb SectorBuilder, tktFn TicketFn) (*Miner, error) {
|
||||||
return &Miner{
|
return &Miner{
|
||||||
api: api,
|
api: api,
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user