Files
kopia/fs/entry_dir_iterator.go
Julio Lopez 8098f49c90 chore(ci): remove exclusion for unused ctx parameters (#4530)
Remove unused-parameter exclusion for `ctx` in revive linter.

---------

Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
Co-authored-by: Matthieu MOREL <matthieu.morel35@gmail.com>
2025-04-26 23:11:36 -07:00

31 lines
623 B
Go

package fs
import "context"
type staticIterator struct {
cur int
entries []Entry
err error
}
func (it *staticIterator) Close() {
}
func (it *staticIterator) Next(_ context.Context) (Entry, error) {
if it.cur < len(it.entries) {
v := it.entries[it.cur]
it.cur++
return v, it.err
}
return nil, nil
}
// StaticIterator returns a DirectoryIterator which returns the provided
// entries in order followed by a given final error.
// It is not safe to concurrently access directory iterator.
func StaticIterator(entries []Entry, err error) DirectoryIterator {
return &staticIterator{0, entries, err}
}