Skip to content

Commit

Permalink
Remove unnecessay prefetch
Browse files Browse the repository at this point in the history
  • Loading branch information
ribasushi committed Mar 27, 2020
1 parent 210bb66 commit f6b707d
Showing 1 changed file with 6 additions and 18 deletions.
24 changes: 6 additions & 18 deletions core/commands/dag/dag.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
cmds "github.com/ipfs/go-ipfs-cmds"
files "github.com/ipfs/go-ipfs-files"
ipld "github.com/ipfs/go-ipld-format"
mdag "github.com/ipfs/go-merkledag"
ipfspath "github.com/ipfs/go-path"
path "github.com/ipfs/interface-go-ipfs-core/path"
mh "github.com/multiformats/go-multihash"
Expand Down Expand Up @@ -271,33 +270,22 @@ The output of blocks happens in strict DAG-traversal, first-seen, order.
)
}

// The current interface of go-car is rather suboptimal as it
// only takes a blockstore, instead of accepting a dagservice,
// and leveraging parallel-fetch capabilities
// https://github.com/ipld/go-car/issues/27
//
// Until the above is fixed, pre-warm the blockstore before doing
// anything else. We explicitly *DO NOT* take a lock during this
// operation: even if we lose some of the blocks we just received
// due to a conflicting GC: we will just re-retrieve anything we
// potentially lost when the car is being streamed out
node, err := cmdenv.GetNode(env)
if err != nil {
return err
}

if err := mdag.FetchGraph(req.Context, c, node.DAG); err != nil {
if !node.IsOnline {
err = fmt.Errorf("%s (currently offline, perhaps retry after attaching to the network)", err)
}
return err
}

// Code disabled until descent-issue in go-ipld-prime is fixed
//
// The second part of the above - make a super-thin wrapper around
// a blockservice session, translating Session.GetBlock() to Blockstore.Get()
//
// The current interface of go-car is rather suboptimal as it
// only takes a blockstore, instead of accepting a dagservice,
// and leveraging parallel-fetch capabilities
// https://github.com/ipld/go-car/issues/27
//
//
// sess := blockservice.NewSession(
// req.Context,
// node.Blocks,
Expand Down

0 comments on commit f6b707d

Please sign in to comment.