"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
Make Google Drive Directory reads concurrent for increased speed.
klauspost6fbd9cf24bc5
diff --git a/drive/drive.go b/drive/drive.goindex 6d6b84e75..b478f0e5b 100644--- a/drive/drive.go+++ b/drive/drive.go@@ -13,6 +13,7 @@ import ("log""net/http""strings"+ "sync""time""golang.org/x/oauth2"@@ -370,15 +371,24 @@ func (f *FsDrive) CreateDir(pathId, leaf string) (newId string, err error) {func (f *FsDrive) listDirRecursive(dirId string, path string, out fs.ObjectsChan) error {var subError error// Make the API request+ var wg sync.WaitGroup_, err := f.listAll(dirId, "", false, false, func(item *drive.File) bool {// Recurse on directories- // FIXME should do this in parallel- // use a wg to sync then collect errorif item.MimeType == driveFolderType {- subError = f.listDirRecursive(item.Id, path+item.Title+"/", out)- if subError != nil {- return true- }+ wg.Add(1)+ folder := path + item.Title + "/"+ fs.Debug(f, "Reading %s", folder)++ go func() {+ defer wg.Done()+ err := f.listDirRecursive(item.Id, folder, out)+ if err != nil {+ subError = err+ fs.ErrorLog(f, "Error reading %s:%s", folder, err)+ }++ }()+ return false} else {// If item has no MD5 sum it isn't stored on drive, so ignore itif item.Md5Checksum != "" {@@ -389,6 +399,8 @@ func (f *FsDrive) listDirRecursive(dirId string, path string, out fs.ObjectsChan}return false})+ wg.Wait()+ fs.Debug(f, "Finished reading %s", path)if err != nil {return err}