Skip to content
Snippets Groups Projects
Unverified Commit 10de1656 authored by Michael Avila's avatar Michael Avila
Browse files

Change to construct provider from go-ipfs-provider

parent 40af13e8
Branches
Tags
No related merge requests found
...@@ -23,12 +23,12 @@ import ( ...@@ -23,12 +23,12 @@ import (
ipnsrp "github.com/ipfs/go-ipfs/namesys/republisher" ipnsrp "github.com/ipfs/go-ipfs/namesys/republisher"
"github.com/ipfs/go-ipfs/p2p" "github.com/ipfs/go-ipfs/p2p"
"github.com/ipfs/go-ipfs/pin" "github.com/ipfs/go-ipfs/pin"
"github.com/ipfs/go-ipfs/provider"
"github.com/ipfs/go-ipfs/repo" "github.com/ipfs/go-ipfs/repo"
bserv "github.com/ipfs/go-blockservice" bserv "github.com/ipfs/go-blockservice"
bstore "github.com/ipfs/go-ipfs-blockstore" bstore "github.com/ipfs/go-ipfs-blockstore"
exchange "github.com/ipfs/go-ipfs-exchange-interface" exchange "github.com/ipfs/go-ipfs-exchange-interface"
"github.com/ipfs/go-ipfs-provider"
ipld "github.com/ipfs/go-ipld-format" ipld "github.com/ipfs/go-ipld-format"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
mfs "github.com/ipfs/go-mfs" mfs "github.com/ipfs/go-mfs"
......
...@@ -22,13 +22,13 @@ import ( ...@@ -22,13 +22,13 @@ import (
"github.com/ipfs/go-ipfs/core/node" "github.com/ipfs/go-ipfs/core/node"
"github.com/ipfs/go-ipfs/namesys" "github.com/ipfs/go-ipfs/namesys"
"github.com/ipfs/go-ipfs/pin" "github.com/ipfs/go-ipfs/pin"
"github.com/ipfs/go-ipfs/provider"
"github.com/ipfs/go-ipfs/repo" "github.com/ipfs/go-ipfs/repo"
bserv "github.com/ipfs/go-blockservice" bserv "github.com/ipfs/go-blockservice"
"github.com/ipfs/go-ipfs-blockstore" "github.com/ipfs/go-ipfs-blockstore"
"github.com/ipfs/go-ipfs-exchange-interface" "github.com/ipfs/go-ipfs-exchange-interface"
offlinexch "github.com/ipfs/go-ipfs-exchange-offline" offlinexch "github.com/ipfs/go-ipfs-exchange-offline"
"github.com/ipfs/go-ipfs-provider"
offlineroute "github.com/ipfs/go-ipfs-routing/offline" offlineroute "github.com/ipfs/go-ipfs-routing/offline"
ipld "github.com/ipfs/go-ipld-format" ipld "github.com/ipfs/go-ipld-format"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
......
...@@ -6,10 +6,13 @@ import ( ...@@ -6,10 +6,13 @@ import (
"time" "time"
"github.com/ipfs/go-ipfs/core/node/helpers" "github.com/ipfs/go-ipfs/core/node/helpers"
"github.com/ipfs/go-ipfs/provider" "github.com/ipfs/go-ipfs/pin"
q "github.com/ipfs/go-ipfs/provider/queue"
"github.com/ipfs/go-ipfs/provider/simple"
"github.com/ipfs/go-ipfs/repo" "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" "github.com/libp2p/go-libp2p-core/routing"
"go.uber.org/fx" "go.uber.org/fx"
) )
...@@ -101,9 +104,9 @@ func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Opti ...@@ -101,9 +104,9 @@ func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Opti
case "": case "":
keyProvider = fx.Provide(simple.NewBlockstoreProvider) keyProvider = fx.Provide(simple.NewBlockstoreProvider)
case "roots": case "roots":
keyProvider = fx.Provide(simple.NewPinnedProvider(true)) keyProvider = fx.Provide(pinnedProviderStrategy(true))
case "pinned": case "pinned":
keyProvider = fx.Provide(simple.NewPinnedProvider(false)) keyProvider = fx.Provide(pinnedProviderStrategy(false))
default: default:
return fx.Error(fmt.Errorf("unknown reprovider strategy '%s'", reprovideStrategy)) return fx.Error(fmt.Errorf("unknown reprovider strategy '%s'", reprovideStrategy))
} }
...@@ -115,3 +118,9 @@ func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Opti ...@@ -115,3 +118,9 @@ func SimpleProviders(reprovideStrategy string, reprovideInterval string) fx.Opti
fx.Provide(SimpleReprovider(reproviderInterval)), 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)
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment