diff --git a/backend/pcloud/pcloud.go b/backend/pcloud/pcloud.go index d4962e30f..ff7fa1a68 100644 --- a/backend/pcloud/pcloud.go +++ b/backend/pcloud/pcloud.go @@ -629,11 +629,31 @@ func (f *Fs) listHelper(ctx context.Context, dir string, recursive bool, callbac // This should return ErrDirNotFound if the directory isn't // found. func (f *Fs) List(ctx context.Context, dir string) (entries fs.DirEntries, err error) { + return list.WithListP(ctx, dir, f) +} + +// ListP lists the objects and directories of the Fs starting +// from dir non recursively into out. +// +// dir should be "" to start from the root, and should not +// have trailing slashes. +// +// This should return ErrDirNotFound if the directory isn't +// found. +// +// It should call callback for each tranche of entries read. +// These need not be returned in any particular order. If +// callback returns an error then the listing will stop +// immediately. +func (f *Fs) ListP(ctx context.Context, dir string, callback fs.ListRCallback) (err error) { + list := list.NewHelper(callback) err = f.listHelper(ctx, dir, false, func(o fs.DirEntry) error { - entries = append(entries, o) - return nil + return list.Add(o) }) - return entries, err + if err != nil { + return err + } + return list.Flush() } // ListR lists the objects and directories of the Fs starting @@ -1377,6 +1397,8 @@ var ( _ fs.DirMover = (*Fs)(nil) _ fs.DirCacheFlusher = (*Fs)(nil) _ fs.PublicLinker = (*Fs)(nil) + _ fs.ListRer = (*Fs)(nil) + _ fs.ListPer = (*Fs)(nil) _ fs.Abouter = (*Fs)(nil) _ fs.Shutdowner = (*Fs)(nil) _ fs.Object = (*Object)(nil)