-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6892 from ipfs/feat/graphsync-server
feat(graphsync): mount the graphsync libp2p protocol
- Loading branch information
Showing
12 changed files
with
592 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package node | ||
|
||
import ( | ||
"github.com/ipfs/go-graphsync" | ||
gsimpl "github.com/ipfs/go-graphsync/impl" | ||
"github.com/ipfs/go-graphsync/ipldbridge" | ||
"github.com/ipfs/go-graphsync/network" | ||
"github.com/ipfs/go-graphsync/storeutil" | ||
"github.com/ipfs/go-ipfs-blockstore" | ||
libp2p "github.com/libp2p/go-libp2p-core" | ||
"go.uber.org/fx" | ||
|
||
"github.com/ipfs/go-ipfs/core/node/helpers" | ||
) | ||
|
||
// Graphsync constructs a graphsync | ||
func Graphsync(lc fx.Lifecycle, mctx helpers.MetricsCtx, host libp2p.Host, bs blockstore.GCBlockstore) graphsync.GraphExchange { | ||
ctx := helpers.LifecycleCtx(mctx, lc) | ||
|
||
network := network.NewFromLibp2pHost(host) | ||
ipldBridge := ipldbridge.NewIPLDBridge() | ||
return gsimpl.New(ctx, | ||
network, ipldBridge, | ||
storeutil.LoaderForBlockstore(bs), | ||
storeutil.StorerForBlockstore(bs), | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.