mirror of
https://github.com/ipfs/kubo.git
synced 2026-02-21 10:27:46 +08:00
fix: update for merkledag API changes
This commit is contained in:
parent
521a29956b
commit
2c222741d1
@ -326,7 +326,7 @@ func provideKeysRec(ctx context.Context, r routing.Routing, dserv ipld.DAGServic
|
|||||||
for _, c := range cids {
|
for _, c := range cids {
|
||||||
kset := cid.NewSet()
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -503,11 +503,7 @@ func pinLsAll(req *cmds.Request, typeStr string, n *core.IpfsNode, emit func(val
|
|||||||
if typeStr == "indirect" || typeStr == "all" {
|
if typeStr == "indirect" || typeStr == "all" {
|
||||||
for _, k := range n.Pinning.RecursiveKeys() {
|
for _, k := range n.Pinning.RecursiveKeys() {
|
||||||
var visitErr error
|
var visitErr error
|
||||||
err := dag.WalkParallelDepth(req.Context, dag.GetLinksWithDAG(n.DAG), k, 0, func(c cid.Cid, depth int) bool {
|
err := dag.Walk(req.Context, dag.GetLinksWithDAG(n.DAG), k, func(c cid.Cid) bool {
|
||||||
if depth == 0 {
|
|
||||||
// skip it without visiting it.
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
r := keys.Visit(c)
|
r := keys.Visit(c)
|
||||||
if r {
|
if r {
|
||||||
err := emit(&PinLsOutputWrapper{
|
err := emit(&PinLsOutputWrapper{
|
||||||
@ -521,7 +517,7 @@ func pinLsAll(req *cmds.Request, typeStr string, n *core.IpfsNode, emit func(val
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return r
|
return r
|
||||||
})
|
}, dag.SkipRoot(), dag.Concurrent())
|
||||||
|
|
||||||
if visitErr != nil {
|
if visitErr != nil {
|
||||||
return visitErr
|
return visitErr
|
||||||
|
|||||||
@ -114,7 +114,7 @@ func provideKeysRec(ctx context.Context, r routing.Routing, bs blockstore.Blocks
|
|||||||
go func() {
|
go func() {
|
||||||
dserv := dag.NewDAGService(blockservice.New(bs, offline.Exchange(bs)))
|
dserv := dag.NewDAGService(blockservice.New(bs, offline.Exchange(bs)))
|
||||||
for _, c := range cids {
|
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 {
|
if err != nil {
|
||||||
errCh <- err
|
errCh <- err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -209,12 +209,10 @@ func (api *PinAPI) pinLsAll(typeStr string, ctx context.Context) ([]coreiface.Pi
|
|||||||
if typeStr == "indirect" || typeStr == "all" {
|
if typeStr == "indirect" || typeStr == "all" {
|
||||||
set := cid.NewSet()
|
set := cid.NewSet()
|
||||||
for _, k := range api.pinning.RecursiveKeys() {
|
for _, k := range api.pinning.RecursiveKeys() {
|
||||||
err := merkledag.WalkParallelDepth(
|
err := merkledag.Walk(
|
||||||
ctx, merkledag.GetLinksWithDAG(api.dag), k, 0,
|
ctx, merkledag.GetLinksWithDAG(api.dag), k,
|
||||||
func(c cid.Cid, depth int) bool {
|
set.Visit,
|
||||||
// don't visit the root node, that doesn't count.
|
merkledag.SkipRoot(), merkledag.Concurrent(),
|
||||||
return depth == 0 || set.Visit(c)
|
|
||||||
},
|
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|||||||
@ -40,7 +40,7 @@ func DiffEnumerate(ctx context.Context, dserv ipld.NodeGetter, from, to cid.Cid)
|
|||||||
if sset.Has(c.aft) {
|
if sset.Has(c.aft) {
|
||||||
continue
|
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 {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|||||||
@ -171,7 +171,7 @@ func Descendants(ctx context.Context, getLinks dag.GetLinks, set *cid.Set, roots
|
|||||||
|
|
||||||
for _, c := range roots {
|
for _, c := range roots {
|
||||||
// Walk recursively walks the dag and adds the keys to the given set
|
// 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 {
|
if err != nil {
|
||||||
err = verboseCidError(err)
|
err = verboseCidError(err)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user