Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
2c222741
Commit
2c222741
authored
Jul 25, 2019
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: update for merkledag API changes
parent
521a2995
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
10 additions
and
16 deletions
+10
-16
core/commands/dht.go
core/commands/dht.go
+1
-1
core/commands/pin.go
core/commands/pin.go
+2
-6
core/coreapi/dht.go
core/coreapi/dht.go
+1
-1
core/coreapi/pin.go
core/coreapi/pin.go
+4
-6
dagutils/diffenum.go
dagutils/diffenum.go
+1
-1
pin/gc/gc.go
pin/gc/gc.go
+1
-1
No files found.
core/commands/dht.go
View file @
2c222741
...
...
@@ -326,7 +326,7 @@ func provideKeysRec(ctx context.Context, r routing.Routing, dserv ipld.DAGServic
for
_
,
c
:=
range
cids
{
kset
:=
cid
.
NewSet
()
err
:=
dag
.
Walk
Parallel
(
ctx
,
dag
.
GetLinksDirect
(
dserv
),
c
,
kset
.
Visit
)
err
:=
dag
.
Walk
(
ctx
,
dag
.
GetLinksDirect
(
dserv
),
c
,
kset
.
Visit
)
if
err
!=
nil
{
return
err
}
...
...
core/commands/pin.go
View file @
2c222741
...
...
@@ -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
...
...
core/coreapi/dht.go
View file @
2c222741
...
...
@@ -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
.
Walk
Parallel
(
ctx
,
dag
.
GetLinksDirect
(
dserv
),
c
,
provided
.
Visitor
(
ctx
))
err
:=
dag
.
Walk
(
ctx
,
dag
.
GetLinksDirect
(
dserv
),
c
,
provided
.
Visitor
(
ctx
))
if
err
!=
nil
{
errCh
<-
err
}
...
...
core/coreapi/pin.go
View file @
2c222741
...
...
@@ -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
...
...
dagutils/diffenum.go
View file @
2c222741
...
...
@@ -40,7 +40,7 @@ func DiffEnumerate(ctx context.Context, dserv ipld.NodeGetter, from, to cid.Cid)
if
sset
.
Has
(
c
.
aft
)
{
continue
}
err
:=
mdag
.
Walk
Parallel
(
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
}
...
...
pin/gc/gc.go
View file @
2c222741
...
...
@@ -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
.
Walk
Parallel
(
ctx
,
verifyGetLinks
,
c
,
set
.
Visit
)
err
:=
dag
.
Walk
(
ctx
,
verifyGetLinks
,
c
,
set
.
Visit
,
dag
.
Concurrent
()
)
if
err
!=
nil
{
err
=
verboseCidError
(
err
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment