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-unixfs
Commits
b5618106
Commit
b5618106
authored
Oct 10, 2018
by
Overbool
Committed by
Lucas Molas
Oct 15, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(resolve): replace switch with if
parent
3512ccf8
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
io/resolve.go
io/resolve.go
+5
-5
No files found.
io/resolve.go
View file @
b5618106
...
...
@@ -13,16 +13,15 @@ import (
// ResolveUnixfsOnce resolves a single hop of a path through a graph in a
// unixfs context. This includes handling traversing sharded directories.
func
ResolveUnixfsOnce
(
ctx
context
.
Context
,
ds
ipld
.
NodeGetter
,
nd
ipld
.
Node
,
names
[]
string
)
(
*
ipld
.
Link
,
[]
string
,
error
)
{
switch
nd
:=
nd
.
(
type
)
{
case
*
dag
.
ProtoNode
:
fsn
,
err
:=
ft
.
FSNodeFromBytes
(
n
d
.
Data
())
pn
,
ok
:=
nd
.
(
*
dag
.
ProtoNode
)
if
ok
{
fsn
,
err
:=
ft
.
FSNodeFromBytes
(
p
n
.
Data
())
if
err
!=
nil
{
// Not a unixfs node, use standard object traversal code
return
nd
.
ResolveLink
(
names
)
}
switch
fsn
.
Type
()
{
case
ft
.
THAMTShard
:
if
fsn
.
Type
()
==
ft
.
THAMTShard
{
rods
:=
dag
.
NewReadOnlyDagService
(
ds
)
s
,
err
:=
hamt
.
NewHamtFromDag
(
rods
,
nd
)
if
err
!=
nil
{
...
...
@@ -37,5 +36,6 @@ func ResolveUnixfsOnce(ctx context.Context, ds ipld.NodeGetter, nd ipld.Node, na
return
out
,
names
[
1
:
],
nil
}
}
return
nd
.
ResolveLink
(
names
)
}
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