deals: Use real data in client

This commit is contained in:
Łukasz Magiera
2019-08-07 20:01:51 -07:00
committed by whyrusleeping
parent c79cb7bf31
commit 7423327b26
5 changed files with 109 additions and 16 deletions
+14 -2
View File
@@ -103,8 +103,20 @@ func StorageMiner(mctx helpers.MetricsCtx, lc fx.Lifecycle, api api.FullNode, h
return sm, nil
}
func HandleDeals(h host.Host, handler *deals.Handler) {
h.SetStreamHandler(deals.ProtocolID, handler.HandleStream)
func HandleDeals(mctx helpers.MetricsCtx, lc fx.Lifecycle, host host.Host, h *deals.Handler) {
ctx := helpers.LifecycleCtx(mctx, lc)
lc.Append(fx.Hook{
OnStart: func(context.Context) error {
h.Run(ctx)
host.SetStreamHandler(deals.ProtocolID, h.HandleStream)
return nil
},
OnStop: func(context.Context) error {
h.Stop()
return nil
},
})
}
func StagingDAG(mctx helpers.MetricsCtx, lc fx.Lifecycle, r repo.LockedRepo, rt routing.Routing, h host.Host) (dtypes.StagingDAG, error) {