split FPoStScheduler from Miner

Rationale: Nodes want to handle scheduling of PoSts. Splitting the 
FPoStScheduler from the Miner allows nodes to reuse the Miner w/out 
having to reuse the PoSt scheduler.
This commit is contained in:
laser
2020-02-03 15:48:11 -08:00
parent c9bd682c33
commit ea2f53745e
4 changed files with 33 additions and 39 deletions
+9 -3
View File
@@ -104,15 +104,21 @@ func StorageMiner(mctx helpers.MetricsCtx, lc fx.Lifecycle, api api.FullNode, h
return nil, err
}
sm, err := storage.NewMiner(api, maddr, h, ds, sb, tktFn)
worker, err := api.StateMinerWorker(helpers.LifecycleCtx(mctx, lc), maddr, nil)
if err != nil {
return nil, err
}
ctx := helpers.LifecycleCtx(mctx, lc)
fps := storage.NewFPoStScheduler(api, sb, maddr, worker)
sm, err := storage.NewMiner(api, maddr, worker, h, ds, sb, tktFn)
if err != nil {
return nil, err
}
lc.Append(fx.Hook{
OnStart: func(context.Context) error {
OnStart: func(ctx context.Context) error {
go fps.Run(ctx)
return sm.Run(ctx)
},
OnStop: sm.Stop,