mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
Change to construct provider from go-ipfs-provider
This commit is contained in:
parent
40af13e8b9
commit
10de165644
@ -23,12 +23,12 @@ import (
|
||||
ipnsrp "github.com/ipfs/go-ipfs/namesys/republisher"
|
||||
"github.com/ipfs/go-ipfs/p2p"
|
||||
"github.com/ipfs/go-ipfs/pin"
|
||||
"github.com/ipfs/go-ipfs/provider"
|
||||
"github.com/ipfs/go-ipfs/repo"
|
||||
|
||||
bserv "github.com/ipfs/go-blockservice"
|
||||
bstore "github.com/ipfs/go-ipfs-blockstore"
|
||||
exchange "github.com/ipfs/go-ipfs-exchange-interface"
|
||||
"github.com/ipfs/go-ipfs-provider"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
logging "github.com/ipfs/go-log"
|
||||
mfs "github.com/ipfs/go-mfs"
|
||||
|
||||
@ -22,13 +22,13 @@ import (
|
||||
"github.com/ipfs/go-ipfs/core/node"
|
||||
"github.com/ipfs/go-ipfs/namesys"
|
||||
"github.com/ipfs/go-ipfs/pin"
|
||||
"github.com/ipfs/go-ipfs/provider"
|
||||
"github.com/ipfs/go-ipfs/repo"
|
||||
|
||||
bserv "github.com/ipfs/go-blockservice"
|
||||
"github.com/ipfs/go-ipfs-blockstore"
|
||||
"github.com/ipfs/go-ipfs-exchange-interface"
|
||||
offlinexch "github.com/ipfs/go-ipfs-exchange-offline"
|
||||
"github.com/ipfs/go-ipfs-provider"
|
||||
offlineroute "github.com/ipfs/go-ipfs-routing/offline"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
logging "github.com/ipfs/go-log"
|
||||
|
||||
@ -6,10 +6,13 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/ipfs/go-ipfs/core/node/helpers"
|
||||
"github.com/ipfs/go-ipfs/provider"
|
||||
q "github.com/ipfs/go-ipfs/provider/queue"
|
||||
"github.com/ipfs/go-ipfs/provider/simple"
|
||||
"github.com/ipfs/go-ipfs/pin"
|
||||
"github.com/ipfs/go-ipfs/repo"
|
||||
|
||||
"github.com/ipfs/go-ipfs-provider"
|
||||
q "github.com/ipfs/go-ipfs-provider/queue"
|
||||
"github.com/ipfs/go-ipfs-provider/simple"
|
||||
ipld "github.com/ipfs/go-ipld-format"
|
||||
"github.com/libp2p/go-libp2p-core/routing"
|
||||
"go.uber.org/fx"
|
||||
)
|
||||
@ -101,9 +104,9 @@ func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Opti
|
||||
case "":
|
||||
keyProvider = fx.Provide(simple.NewBlockstoreProvider)
|
||||
case "roots":
|
||||
keyProvider = fx.Provide(simple.NewPinnedProvider(true))
|
||||
keyProvider = fx.Provide(pinnedProviderStrategy(true))
|
||||
case "pinned":
|
||||
keyProvider = fx.Provide(simple.NewPinnedProvider(false))
|
||||
keyProvider = fx.Provide(pinnedProviderStrategy(false))
|
||||
default:
|
||||
return fx.Error(fmt.Errorf("unknown reprovider strategy '%s'", reprovideStrategy))
|
||||
}
|
||||
@ -115,3 +118,9 @@ func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Opti
|
||||
fx.Provide(SimpleReprovider(reproviderInterval)),
|
||||
)
|
||||
}
|
||||
|
||||
func pinnedProviderStrategy(onlyRoots bool) interface{} {
|
||||
return func(pinner pin.Pinner, dag ipld.DAGService) simple.KeyChanFunc {
|
||||
return simple.NewPinnedProvider(onlyRoots, pinner, dag)
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user