Skip to content

Commit

Permalink
Add LsIter to iterate items from UnixfsAPI interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
gammazero committed Oct 16, 2024
1 parent 4518603 commit 34495cf
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/coreiface/unixfs.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package iface

import (
"context"
"iter"
"os"
"time"

Expand Down Expand Up @@ -97,7 +98,6 @@ type UnixfsAPI interface {
Ls(context.Context, path.Path, ...options.UnixfsLsOption) (<-chan DirEntry, <-chan error)
}

/* TODO: Uncomment after go1.23 required.
// LsIter returns a go iterator that allows ranging over DirEntry results.
// Iteration stops if the context is canceled or if the iterator yields an
// error.
Expand All @@ -120,9 +120,8 @@ func LsIter(ctx context.Context, api UnixfsAPI, p path.Path, opts ...options.Uni
return
}
}
if err != <-asyncErr; err != nil {
yield(nil, err)
if err := <-asyncErr; err != nil {
yield(DirEntry{}, err)
}
}
}
*/

0 comments on commit 34495cf

Please sign in to comment.