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
c54d0e47
Commit
c54d0e47
authored
Oct 29, 2018
by
hannahhoward
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(EnumLinksAsync): Remove error since it's unused
parent
269f6d22
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
20 deletions
+12
-20
hamt/hamt.go
hamt/hamt.go
+5
-8
hamt/hamt_test.go
hamt/hamt_test.go
+2
-4
io/directory.go
io/directory.go
+4
-4
io/directory_test.go
io/directory_test.go
+1
-4
No files found.
hamt/hamt.go
View file @
c54d0e47
...
...
@@ -29,9 +29,8 @@ import (
cid
"github.com/ipfs/go-cid"
ipld
"github.com/ipfs/go-ipld-format"
dag
"github.com/ipfs/go-merkledag"
"github.com/spaolacci/murmur3"
format
"github.com/ipfs/go-unixfs"
"github.com/spaolacci/murmur3"
)
const
(
...
...
@@ -401,10 +400,8 @@ func (ds *Shard) getValue(ctx context.Context, hv *hashBits, key string, cb func
func
(
ds
*
Shard
)
EnumLinks
(
ctx
context
.
Context
)
([]
*
ipld
.
Link
,
error
)
{
var
links
[]
*
ipld
.
Link
linkResults
,
err
:=
ds
.
EnumLinksAsync
(
ctx
)
if
err
!=
nil
{
return
nil
,
err
}
linkResults
:=
ds
.
EnumLinksAsync
(
ctx
)
for
linkResult
:=
range
linkResults
{
if
linkResult
.
Err
!=
nil
{
return
links
,
linkResult
.
Err
...
...
@@ -426,7 +423,7 @@ func (ds *Shard) ForEachLink(ctx context.Context, f func(*ipld.Link) error) erro
// EnumLinksAsync returns a channel which will receive Links in the directory
// as they are enumerated, where order is not gauranteed
func
(
ds
*
Shard
)
EnumLinksAsync
(
ctx
context
.
Context
)
(
<-
chan
format
.
LinkResult
,
error
)
{
func
(
ds
*
Shard
)
EnumLinksAsync
(
ctx
context
.
Context
)
<-
chan
format
.
LinkResult
{
linkResults
:=
make
(
chan
format
.
LinkResult
)
ctx
,
cancel
:=
context
.
WithCancel
(
ctx
)
go
func
()
{
...
...
@@ -439,7 +436,7 @@ func (ds *Shard) EnumLinksAsync(ctx context.Context) (<-chan format.LinkResult,
emitResult
(
ctx
,
linkResults
,
format
.
LinkResult
{
Link
:
nil
,
Err
:
err
})
}
}()
return
linkResults
,
nil
return
linkResults
}
// makeAsyncTrieGetLinks builds a getLinks function that can be used with EnumerateChildrenAsync
...
...
hamt/hamt_test.go
View file @
c54d0e47
...
...
@@ -337,10 +337,8 @@ func TestEnumLinksAsync(t *testing.T) {
t
.
Fatal
(
err
)
}
linkResults
,
err
:=
nds
.
EnumLinksAsync
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
linkResults
:=
nds
.
EnumLinksAsync
(
ctx
)
var
linksB
[]
*
ipld
.
Link
for
linkResult
:=
range
linkResults
{
...
...
io/directory.go
View file @
c54d0e47
...
...
@@ -41,7 +41,7 @@ type Directory interface {
// EnumLinksAsync returns a channel which will receive Links in the directory
// as they are enumerated, where order is not gauranteed
EnumLinksAsync
(
context
.
Context
)
(
<-
chan
format
.
LinkResult
,
error
)
EnumLinksAsync
(
context
.
Context
)
<-
chan
format
.
LinkResult
// Links returns the all the links in the directory node.
Links
(
context
.
Context
)
([]
*
ipld
.
Link
,
error
)
...
...
@@ -148,7 +148,7 @@ func (d *BasicDirectory) AddChild(ctx context.Context, name string, node ipld.No
// EnumLinksAsync returns a channel which will receive Links in the directory
// as they are enumerated, where order is not gauranteed
func
(
d
*
BasicDirectory
)
EnumLinksAsync
(
ctx
context
.
Context
)
(
<-
chan
format
.
LinkResult
,
error
)
{
func
(
d
*
BasicDirectory
)
EnumLinksAsync
(
ctx
context
.
Context
)
<-
chan
format
.
LinkResult
{
linkResults
:=
make
(
chan
format
.
LinkResult
)
go
func
()
{
defer
close
(
linkResults
)
...
...
@@ -163,7 +163,7 @@ func (d *BasicDirectory) EnumLinksAsync(ctx context.Context) (<-chan format.Link
}
}
}()
return
linkResults
,
nil
return
linkResults
}
// ForEachLink implements the `Directory` interface.
...
...
@@ -253,7 +253,7 @@ func (d *HAMTDirectory) ForEachLink(ctx context.Context, f func(*ipld.Link) erro
// EnumLinksAsync returns a channel which will receive Links in the directory
// as they are enumerated, where order is not gauranteed
func
(
d
*
HAMTDirectory
)
EnumLinksAsync
(
ctx
context
.
Context
)
(
<-
chan
format
.
LinkResult
,
error
)
{
func
(
d
*
HAMTDirectory
)
EnumLinksAsync
(
ctx
context
.
Context
)
<-
chan
format
.
LinkResult
{
return
d
.
shard
.
EnumLinksAsync
(
ctx
)
}
...
...
io/directory_test.go
View file @
c54d0e47
...
...
@@ -158,10 +158,7 @@ func TestDirBuilder(t *testing.T) {
t
.
Fatal
(
"wrong number of links"
,
len
(
links
),
count
)
}
linkResults
,
err
:=
dir
.
EnumLinksAsync
(
ctx
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
linkResults
:=
dir
.
EnumLinksAsync
(
ctx
)
asyncNames
:=
make
(
map
[
string
]
bool
)
var
asyncLinks
[]
*
ipld
.
Link
...
...
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