Commit 2c222741 authored by Steven Allen's avatar Steven Allen

fix: update for merkledag API changes

parent 521a2995
......@@ -326,7 +326,7 @@ func provideKeysRec(ctx context.Context, r routing.Routing, dserv ipld.DAGServic
for _, c := range cids {
kset := cid.NewSet()
err := dag.WalkParallel(ctx, dag.GetLinksDirect(dserv), c, kset.Visit)
err := dag.Walk(ctx, dag.GetLinksDirect(dserv), c, kset.Visit)
if err != nil {
return err
}
......
......@@ -503,11 +503,7 @@ func pinLsAll(req *cmds.Request, typeStr string, n *core.IpfsNode, emit func(val
if typeStr == "indirect" || typeStr == "all" {
for _, k := range n.Pinning.RecursiveKeys() {
var visitErr error
err := dag.WalkParallelDepth(req.Context, dag.GetLinksWithDAG(n.DAG), k, 0, func(c cid.Cid, depth int) bool {
if depth == 0 {
// skip it without visiting it.
return true
}
err := dag.Walk(req.Context, dag.GetLinksWithDAG(n.DAG), k, func(c cid.Cid) bool {
r := keys.Visit(c)
if r {
err := emit(&PinLsOutputWrapper{
......@@ -521,7 +517,7 @@ func pinLsAll(req *cmds.Request, typeStr string, n *core.IpfsNode, emit func(val
}
}
return r
})
}, dag.SkipRoot(), dag.Concurrent())
if visitErr != nil {
return visitErr
......
......@@ -114,7 +114,7 @@ func provideKeysRec(ctx context.Context, r routing.Routing, bs blockstore.Blocks
go func() {
dserv := dag.NewDAGService(blockservice.New(bs, offline.Exchange(bs)))
for _, c := range cids {
err := dag.WalkParallel(ctx, dag.GetLinksDirect(dserv), c, provided.Visitor(ctx))
err := dag.Walk(ctx, dag.GetLinksDirect(dserv), c, provided.Visitor(ctx))
if err != nil {
errCh <- err
}
......
......@@ -209,12 +209,10 @@ func (api *PinAPI) pinLsAll(typeStr string, ctx context.Context) ([]coreiface.Pi
if typeStr == "indirect" || typeStr == "all" {
set := cid.NewSet()
for _, k := range api.pinning.RecursiveKeys() {
err := merkledag.WalkParallelDepth(
ctx, merkledag.GetLinksWithDAG(api.dag), k, 0,
func(c cid.Cid, depth int) bool {
// don't visit the root node, that doesn't count.
return depth == 0 || set.Visit(c)
},
err := merkledag.Walk(
ctx, merkledag.GetLinksWithDAG(api.dag), k,
set.Visit,
merkledag.SkipRoot(), merkledag.Concurrent(),
)
if err != nil {
return nil, err
......
......@@ -40,7 +40,7 @@ func DiffEnumerate(ctx context.Context, dserv ipld.NodeGetter, from, to cid.Cid)
if sset.Has(c.aft) {
continue
}
err := mdag.WalkParallel(ctx, mdag.GetLinksDirect(dserv), c.aft, sset.Visit)
err := mdag.Walk(ctx, mdag.GetLinksDirect(dserv), c.aft, sset.Visit, mdag.Concurrent())
if err != nil {
return err
}
......
......@@ -171,7 +171,7 @@ func Descendants(ctx context.Context, getLinks dag.GetLinks, set *cid.Set, roots
for _, c := range roots {
// Walk recursively walks the dag and adds the keys to the given set
err := dag.WalkParallel(ctx, verifyGetLinks, c, set.Visit)
err := dag.Walk(ctx, verifyGetLinks, c, set.Visit, dag.Concurrent())
if err != nil {
err = verboseCidError(err)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment