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
cd9b8c9f
Commit
cd9b8c9f
authored
May 05, 2021
by
Lucas Molas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: add pointer receiver
parent
930e8c98
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
4 deletions
+4
-4
io/directory.go
io/directory.go
+2
-2
io/directory_test.go
io/directory_test.go
+2
-2
No files found.
io/directory.go
View file @
cd9b8c9f
...
...
@@ -100,7 +100,7 @@ func NewDirectory(dserv ipld.DAGService) Directory {
basicDir
:=
new
(
BasicDirectory
)
basicDir
.
node
=
format
.
EmptyDirNode
()
basicDir
.
dserv
=
dserv
return
UpgradeableDirectory
{
basicDir
}
return
&
UpgradeableDirectory
{
basicDir
}
}
// ErrNotADir implies that the given node was not a unixfs directory
...
...
@@ -308,7 +308,7 @@ var _ Directory = (*UpgradeableDirectory)(nil)
// AddChild implements the `Directory` interface. We check when adding new entries
// if we should switch to HAMTDirectory according to global option(s).
func
(
d
UpgradeableDirectory
)
AddChild
(
ctx
context
.
Context
,
name
string
,
nd
ipld
.
Node
)
error
{
func
(
d
*
UpgradeableDirectory
)
AddChild
(
ctx
context
.
Context
,
name
string
,
nd
ipld
.
Node
)
error
{
if
UseHAMTSharding
{
if
basicDir
,
ok
:=
d
.
Directory
.
(
*
BasicDirectory
);
ok
{
hamtDir
,
err
:=
basicDir
.
SwitchToSharding
(
ctx
)
...
...
io/directory_test.go
View file @
cd9b8c9f
...
...
@@ -105,7 +105,7 @@ func TestUpgradeableDirectory(t *testing.T) {
ds
:=
mdtest
.
Mock
()
UseHAMTSharding
=
false
// Create a BasicDirectory.
dir
:=
NewDirectory
(
ds
)
if
_
,
ok
:=
dir
.
(
UpgradeableDirectory
)
.
Directory
.
(
*
BasicDirectory
);
!
ok
{
if
_
,
ok
:=
dir
.
(
*
UpgradeableDirectory
)
.
Directory
.
(
*
BasicDirectory
);
!
ok
{
t
.
Fatal
(
"UpgradeableDirectory doesn't contain BasicDirectory"
)
}
...
...
@@ -117,7 +117,7 @@ func TestUpgradeableDirectory(t *testing.T) {
t
.
Fatal
(
err
)
}
if
_
,
ok
:=
dir
.
(
UpgradeableDirectory
)
.
Directory
.
(
*
HAMTDirectory
);
!
ok
{
if
_
,
ok
:=
dir
.
(
*
UpgradeableDirectory
)
.
Directory
.
(
*
HAMTDirectory
);
!
ok
{
t
.
Fatal
(
"UpgradeableDirectory wasn't upgraded to HAMTDirectory"
)
}
}
...
...
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