Skip to content

Commit

Permalink
REWORD
Browse files Browse the repository at this point in the history
  • Loading branch information
Jorropo committed Jun 2, 2023
1 parent e0e8fc8 commit 5bceecb
Showing 1 changed file with 3 additions and 22 deletions.
25 changes: 3 additions & 22 deletions core/coreapi/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func (api *PinAPI) pinLsAll(ctx context.Context, typeStr string) <-chan coreifac
out <- &pinInfo{err: err}
return
}
rkeys = append(rkeys, streamedCid.C)
}
}
if typeStr == "direct" || typeStr == "all" {
Expand All @@ -319,27 +320,6 @@ func (api *PinAPI) pinLsAll(ctx context.Context, typeStr string) <-chan coreifac
}
}
}
if typeStr == "all" {
walkingSet := cid.NewSet()
for _, k := range rkeys {
err = merkledag.Walk(
ctx, merkledag.GetLinksWithDAG(api.dag), k,
walkingSet.Visit,
merkledag.SkipRoot(), merkledag.Concurrent(),
)
if err != nil {
out <- &pinInfo{err: err}
return
}
}
err = walkingSet.ForEach(func(c cid.Cid) error {
return AddToResultKeys(c, "indirect")
})
if err != nil {
out <- &pinInfo{err: err}
return
}
}
if typeStr == "indirect" {
// We need to first visit the direct pins that have priority
// without emitting them
Expand All @@ -360,7 +340,8 @@ func (api *PinAPI) pinLsAll(ctx context.Context, typeStr string) <-chan coreifac
emittedSet.Add(streamedCid.C)
rkeys = append(rkeys, streamedCid.C)
}

}
if typeStr == "indirect" || typeStr == "all" {
walkingSet := cid.NewSet()
for _, k := range rkeys {
err = merkledag.Walk(
Expand Down

0 comments on commit 5bceecb

Please sign in to comment.