Skip to content

Commit

Permalink
core/commands/pin: refactor to use gc.Descendants()
Browse files Browse the repository at this point in the history
License: MIT
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
  • Loading branch information
chriscool committed Jan 21, 2016
1 parent 29830da commit 7e89859
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions core/commands/pin.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
core "github.com/ipfs/go-ipfs/core"
corerepo "github.com/ipfs/go-ipfs/core/corerepo"
dag "github.com/ipfs/go-ipfs/merkledag"
gc "github.com/ipfs/go-ipfs/pin/gc"
path "github.com/ipfs/go-ipfs/path"
u "github.com/ipfs/go-ipfs/util"
)
Expand Down Expand Up @@ -327,15 +327,9 @@ func pinLsAll(typeStr string, ctx context.Context, n *core.IpfsNode) (map[string
}
if typeStr == "indirect" || typeStr == "all" {
ks := key.NewKeySet()
for _, k := range n.Pinning.RecursiveKeys() {
nd, err := n.DAG.Get(ctx, k)
if err != nil {
return nil, err
}
err = dag.EnumerateChildren(n.Context(), n.DAG, nd, ks)
if err != nil {
return nil, err
}
err := gc.Descendants(n.DAG, ks, n.Pinning.RecursiveKeys())
if err != nil {
return nil, err
}
AddToResultKeys(ks.Keys(), "indirect")
}
Expand Down

0 comments on commit 7e89859

Please sign in to comment.