@cryptotaxi247 / kubo / commits / c2f9849a2

Fastify with go-car version taking a session

Peter Rabbitson committed Mar 27, 2020 at 19:24 UTC c2f9849a2be6b6c6a156b6f0978afed916bc7e67
3 files changed +10 -21
core/commands/dag/dag.go
+7 -18
@@ -8,6 +8,7 @@ import (
8
9 "github.com/ipfs/go-ipfs/core/commands/cmdenv"
10 "github.com/ipfs/go-ipfs/core/coredag"
11 + mdag "github.com/ipfs/go-merkledag"
12
13 cid "github.com/ipfs/go-cid"
14 cidenc "github.com/ipfs/go-cidutil/cidenc"
@@ -276,27 +277,12 @@ The output of blocks happens in strict DAG-traversal, first-seen, order.
277 }
278
279 // Code disabled until descent-issue in go-ipld-prime is fixed
280 + // https://github.com/ribasushi/gip-muddle-up
281 //
280 - // The second part of the above - make a super-thin wrapper around
281 - // a blockservice session, translating Session.GetBlock() to Blockstore.Get()
282 - //
283 - // The current interface of go-car is rather suboptimal as it
284 - // only takes a blockstore, instead of accepting a dagservice,
285 - // and leveraging parallel-fetch capabilities
286 - // https://github.com/ipld/go-car/issues/27
287 - //
288 - //
289 - // sess := blockservice.NewSession(
290 - // req.Context,
291 - // node.Blocks,
292 - // )
293 - // var wrapper getBlockFromSessionWrapper = func(c cid.Cid) (blk.Block, error) {
294 - // return sess.GetBlock(req.Context, c)
295 - // }
282 // sb := gipselectorbuilder.NewSelectorSpecBuilder(gipfree.NodeBuilder())
283 // car := gocar.NewSelectiveCar(
284 // req.Context,
299 - // &wrapper,
285 + // <needs to be fixed to take format.NodeGetter as well>,
286 // []gocar.Dag{gocar.Dag{
287 // Root: c,
288 // Selector: sb.ExploreRecursive(
@@ -320,7 +306,10 @@ The output of blocks happens in strict DAG-traversal, first-seen, order.
306 //if err := car.Write(pipeW); err != nil {
307 if err := gocar.WriteCar(
308 req.Context,
323 - node.DAG,
309 + mdag.NewSession(
310 + req.Context,
311 + node.DAG,
312 + ),
313 []cid.Cid{c},
314 pipeW,
315 ); err != nil {
go.mod
+1 -1
@@ -54,7 +54,7 @@ require (
54 github.com/ipfs/go-unixfs v0.2.4
55 github.com/ipfs/go-verifcid v0.0.1
56 github.com/ipfs/interface-go-ipfs-core v0.2.6
57 - github.com/ipld/go-car v0.0.5-0.20200316204026-3e2cf7af0fab
57 + github.com/ipld/go-car v0.0.5-0.20200327173242-8a3014575e8e
58 github.com/jbenet/go-is-domain v1.0.3
59 github.com/jbenet/go-random v0.0.0-20190219211222-123a90aedc0c
60 github.com/jbenet/go-temp-err-catcher v0.1.0
go.sum
+2 -2
@@ -354,8 +354,8 @@ github.com/ipfs/go-verifcid v0.0.1 h1:m2HI7zIuR5TFyQ1b79Da5N9dnnCP1vcu2QqawmWlK2
354 github.com/ipfs/go-verifcid v0.0.1/go.mod h1:5Hrva5KBeIog4A+UpqlaIU+DEstipcJYQQZc0g37pY0=
355 github.com/ipfs/interface-go-ipfs-core v0.2.6 h1:4eeGPJUDWblEurSzpAtL2znDG1xqAoX2aNNIoOFwyuc=
356 github.com/ipfs/interface-go-ipfs-core v0.2.6/go.mod h1:Tihp8zxGpUeE3Tokr94L6zWZZdkRQvG5TL6i9MuNE+s=
357 -github.com/ipld/go-car v0.0.5-0.20200316204026-3e2cf7af0fab h1:+3Y6Jb3IBmG3t6e3r6TItnuciOaMOuGW7QIVEUa5vy4=
358 -github.com/ipld/go-car v0.0.5-0.20200316204026-3e2cf7af0fab/go.mod h1:yR5AsJ38xTwwgwGpbh60ICtdLPp5lGfuH28PAAzaEhM=
357 +github.com/ipld/go-car v0.0.5-0.20200327173242-8a3014575e8e h1:Sono8LppfRvQhSp6ozSmjdW7xtv45BYRMFU4xqJQs34=
358 +github.com/ipld/go-car v0.0.5-0.20200327173242-8a3014575e8e/go.mod h1:yR5AsJ38xTwwgwGpbh60ICtdLPp5lGfuH28PAAzaEhM=
359 github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785 h1:fASnkvtR+SmB2y453RxmDD3Uvd4LonVUgFGk9JoDaZs=
360 github.com/ipld/go-ipld-prime v0.0.2-0.20191108012745-28a82f04c785/go.mod h1:bDDSvVz7vaK12FNvMeRYnpRFkSUPNQOiCYQezMD/P3w=
361 github.com/ipld/go-ipld-prime-proto v0.0.0-20191113031812-e32bd156a1e5 h1:lSip43rAdyGA+yRQuy6ju0ucZkWpYc1F2CTQtZTVW/4=