node: wire up new storage manager

This commit is contained in:
Łukasz Magiera 2020-03-04 20:42:49 +01:00
parent 799ff17c7c
commit e483383a44
2 changed files with 18 additions and 0 deletions

View File

@ -56,6 +56,8 @@ import (
"github.com/filecoin-project/lotus/paychmgr" "github.com/filecoin-project/lotus/paychmgr"
"github.com/filecoin-project/lotus/storage" "github.com/filecoin-project/lotus/storage"
"github.com/filecoin-project/lotus/storage/sealing" "github.com/filecoin-project/lotus/storage/sealing"
"github.com/filecoin-project/lotus/storage/sealmgr"
"github.com/filecoin-project/lotus/storage/sealmgr/advmgr"
"github.com/filecoin-project/lotus/storage/sectorblocks" "github.com/filecoin-project/lotus/storage/sectorblocks"
) )
@ -253,6 +255,13 @@ 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.Config), modules.SectorBuilderConfig),
Override(new(advmgr.LocalStorage), From(new(repo.LockedRepo))),
Override(new(*advmgr.Manager), advmgr.New),
Override(new(sealmgr.Manager), From(new(*advmgr.Manager))),
Override(new(sectorbuilder.Prover), From(new(sealmgr.Manager))),
Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks), Override(new(*sectorblocks.SectorBlocks), sectorblocks.NewSectorBlocks),
Override(new(sealing.TicketFn), modules.SealTicketGen), Override(new(sealing.TicketFn), modules.SealTicketGen),
Override(new(*storage.Miner), modules.StorageMiner), Override(new(*storage.Miner), modules.StorageMiner),

View File

@ -84,6 +84,15 @@ func Unset(typ interface{}) Option {
} }
} }
// From(*T) -> func(t T) T {return t}
func From(typ interface{}) interface{} {
rt := []reflect.Type{reflect.TypeOf(typ).Elem()}
ft := reflect.FuncOf(rt, rt, false)
return reflect.MakeFunc(ft, func(args []reflect.Value) (results []reflect.Value) {
return args
}).Interface()
}
// from go-ipfs // from go-ipfs
// as casts input constructor to a given interface (if a value is given, it // as casts input constructor to a given interface (if a value is given, it
// wraps it into a constructor). // wraps it into a constructor).