@cryptotaxi247 / kubo / commits / 10de16564

Change to construct provider from go-ipfs-provider

Michael Avila committed Jul 3, 2019 at 14:22 UTC 10de165644ebd0e37fba4b31c9976268096cb6f3
3 files changed +16 -7
core/core.go
+1 -1
@@ -23,12 +23,12 @@ import (
23 ipnsrp "github.com/ipfs/go-ipfs/namesys/republisher"
24 "github.com/ipfs/go-ipfs/p2p"
25 "github.com/ipfs/go-ipfs/pin"
26 - "github.com/ipfs/go-ipfs/provider"
26 "github.com/ipfs/go-ipfs/repo"
27
28 bserv "github.com/ipfs/go-blockservice"
29 bstore "github.com/ipfs/go-ipfs-blockstore"
30 exchange "github.com/ipfs/go-ipfs-exchange-interface"
31 + "github.com/ipfs/go-ipfs-provider"
32 ipld "github.com/ipfs/go-ipld-format"
33 logging "github.com/ipfs/go-log"
34 mfs "github.com/ipfs/go-mfs"
core/coreapi/coreapi.go
+1 -1
@@ -22,13 +22,13 @@ import (
22 "github.com/ipfs/go-ipfs/core/node"
23 "github.com/ipfs/go-ipfs/namesys"
24 "github.com/ipfs/go-ipfs/pin"
25 - "github.com/ipfs/go-ipfs/provider"
25 "github.com/ipfs/go-ipfs/repo"
26
27 bserv "github.com/ipfs/go-blockservice"
28 "github.com/ipfs/go-ipfs-blockstore"
29 "github.com/ipfs/go-ipfs-exchange-interface"
30 offlinexch "github.com/ipfs/go-ipfs-exchange-offline"
31 + "github.com/ipfs/go-ipfs-provider"
32 offlineroute "github.com/ipfs/go-ipfs-routing/offline"
33 ipld "github.com/ipfs/go-ipld-format"
34 logging "github.com/ipfs/go-log"
core/node/provider.go
+14 -5
@@ -6,10 +6,13 @@ import (
6 "time"
7
8 "github.com/ipfs/go-ipfs/core/node/helpers"
9 - "github.com/ipfs/go-ipfs/provider"
10 - q "github.com/ipfs/go-ipfs/provider/queue"
11 - "github.com/ipfs/go-ipfs/provider/simple"
9 + "github.com/ipfs/go-ipfs/pin"
10 "github.com/ipfs/go-ipfs/repo"
11 +
12 + "github.com/ipfs/go-ipfs-provider"
13 + q "github.com/ipfs/go-ipfs-provider/queue"
14 + "github.com/ipfs/go-ipfs-provider/simple"
15 + ipld "github.com/ipfs/go-ipld-format"
16 "github.com/libp2p/go-libp2p-core/routing"
17 "go.uber.org/fx"
18 )
@@ -101,9 +104,9 @@ func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Opti
104 case "":
105 keyProvider = fx.Provide(simple.NewBlockstoreProvider)
106 case "roots":
104 - keyProvider = fx.Provide(simple.NewPinnedProvider(true))
107 + keyProvider = fx.Provide(pinnedProviderStrategy(true))
108 case "pinned":
106 - keyProvider = fx.Provide(simple.NewPinnedProvider(false))
109 + keyProvider = fx.Provide(pinnedProviderStrategy(false))
110 default:
111 return fx.Error(fmt.Errorf("unknown reprovider strategy '%s'", reprovideStrategy))
112 }
@@ -115,3 +118,9 @@ func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Opti
118 fx.Provide(SimpleReprovider(reproviderInterval)),
119 )
120 }
121 +
122 +func pinnedProviderStrategy(onlyRoots bool) interface{} {
123 + return func(pinner pin.Pinner, dag ipld.DAGService) simple.KeyChanFunc {
124 + return simple.NewPinnedProvider(onlyRoots, pinner, dag)
125 + }
126 +}