Commit c54d0e47 authored by hannahhoward's avatar hannahhoward

feat(EnumLinksAsync): Remove error since it's unused

parent 269f6d22
......@@ -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
......
......@@ -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 {
......
......@@ -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)
}
......
......@@ -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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment