"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files
Go azure-blobazure-blob-storageazure-filesbackblaze-b2cloud-storagedropboxencryptionftpfuse-filesystemgogolanggoogle-cloud-storagegoogle-driveonedriveopenstack-swiftrclones3sftpsyncwebdav
fs: define ListP interface for paged listing #4788
Nick Craig-Wood2a90de950251
diff --git a/fs/features.go b/fs/features.goindex 7306f537c..1563dc459 100644--- a/fs/features.go+++ b/fs/features.go@@ -159,6 +159,21 @@ type Features struct {// of listing recursively that doing a directory traversal.ListR ListRFn+ // ListP lists the objects and directories of the Fs starting+ // from dir non recursively to 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.+ ListP func(ctx context.Context, dir string, callback ListRCallback) error+// About gets quota information from the FsAbout func(ctx context.Context) (*Usage, error)@@ -327,6 +342,9 @@ func (ft *Features) Fill(ctx context.Context, f Fs) *Features {if do, ok := f.(ListRer); ok {ft.ListR = do.ListR}+ if do, ok := f.(ListPer); ok {+ ft.ListP = do.ListP+ }if do, ok := f.(Abouter); ok {ft.About = do.About}@@ -435,6 +453,9 @@ func (ft *Features) Mask(ctx context.Context, f Fs) *Features {if mask.ListR == nil {ft.ListR = nil}+ if mask.ListP == nil {+ ft.ListP = nil+ }if mask.About == nil {ft.About = nil}@@ -663,6 +684,24 @@ type ListRer interface {ListR(ctx context.Context, dir string, callback ListRCallback) error}+// ListPer is an optional interfaces for Fs+type ListPer interface {+ // 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.+ ListP(ctx context.Context, dir string, callback ListRCallback) error+}+// RangeSeeker is the interface that wraps the RangeSeek method.//// Some of the returns from Object.Open() may optionally implementdiff --git a/fs/types.go b/fs/types.goindex 2ed4e588b..c664ce162 100644--- a/fs/types.go+++ b/fs/types.go@@ -311,6 +311,7 @@ func DirectoryOptionalInterfaces(d Directory) (supported, unsupported []string)type ListRCallback func(entries DirEntries) error// ListRFn is defines the call used to recursively list a directory+// with ListR or page through a directory with ListPtype ListRFn func(ctx context.Context, dir string, callback ListRCallback) error// Flagger describes the interface rclone config types flags must satisfy