"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: add optional ID to fs.Directory and set it in the remotes which care
Nick Craig-Wood81a2ab599ffa
diff --git a/amazonclouddrive/amazonclouddrive.go b/amazonclouddrive/amazonclouddrive.goindex e42d13eb9..ca7f325a8 100644--- a/amazonclouddrive/amazonclouddrive.go+++ b/amazonclouddrive/amazonclouddrive.go@@ -427,7 +427,7 @@ func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {// cache the directory ID for later lookupsf.dirCache.Put(remote, *node.Id)when, _ := time.Parse(timeFormat, *node.ModifiedDate) // FIXME- d := fs.NewDir(remote, when)+ d := fs.NewDir(remote, when).SetID(*node.Id)entries = append(entries, d)case fileKind:o, err := f.newObjectWithInfo(remote, node)diff --git a/box/box.go b/box/box.goindex 6af16ce43..0fb076468 100644--- a/box/box.go+++ b/box/box.go@@ -454,7 +454,7 @@ func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {if info.Type == api.ItemTypeFolder {// cache the directory ID for later lookupsf.dirCache.Put(remote, info.ID)- d := fs.NewDir(remote, info.ModTime())+ d := fs.NewDir(remote, info.ModTime()).SetID(info.ID)// FIXME more info from dir?entries = append(entries, d)} else if info.Type == api.ItemTypeFile {diff --git a/drive/drive.go b/drive/drive.goindex 9605c4ae8..ff277e7ad 100644--- a/drive/drive.go+++ b/drive/drive.go@@ -591,7 +591,7 @@ func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {// cache the directory ID for later lookupsf.dirCache.Put(remote, item.Id)when, _ := time.Parse(timeFormatIn, item.ModifiedDate)- d := fs.NewDir(remote, when)+ d := fs.NewDir(remote, when).SetID(item.Id)entries = append(entries, d)case item.Md5Checksum != "" || item.FileSize > 0:// If item has MD5 sum or a length it is a file stored on drivediff --git a/fs/dir.go b/fs/dir.goindex d95a0f5e8..891dc8d63 100644--- a/fs/dir.go+++ b/fs/dir.go@@ -8,6 +8,7 @@ type Dir struct {modTime time.Time // modification or creation time - IsZero for unknownsize int64 // size of directory and contents or -1 if unknownitems int64 // number of objects or -1 for unknown+ id string // optional ID}// NewDir creates an unspecialized Directory object@@ -46,6 +47,17 @@ func (d *Dir) SetRemote(remote string) *Dir {return d}+// ID gets the optional ID+func (d *Dir) ID() string {+ return d.id+}++// SetID sets the optional ID+func (d *Dir) SetID(id string) *Dir {+ d.id = id+ return d+}+// ModTime returns the modification date of the file// It should return a best guess if one isn't availablefunc (d *Dir) ModTime() time.Time {diff --git a/fs/fs.go b/fs/fs.goindex c3500edc0..38e3ae010 100644--- a/fs/fs.go+++ b/fs/fs.go@@ -219,6 +219,10 @@ type Directory interface {// Items returns the count of items in this directory or this// directory and subdirectories if known, -1 for unknownItems() int64++ // ID returns the internal ID of this directory if known, or+ // "" otherwise+ ID() string}// MimeTyper is an optional interface for Objectdiff --git a/onedrive/onedrive.go b/onedrive/onedrive.goindex ab53b1b6c..3616edcea 100644--- a/onedrive/onedrive.go+++ b/onedrive/onedrive.go@@ -423,7 +423,7 @@ func (f *Fs) List(dir string) (entries fs.DirEntries, err error) {if info.Folder != nil {// cache the directory ID for later lookupsf.dirCache.Put(remote, info.ID)- d := fs.NewDir(remote, time.Time(info.LastModifiedDateTime))+ d := fs.NewDir(remote, time.Time(info.LastModifiedDateTime)).SetID(info.ID)if info.Folder != nil {d.SetItems(info.Folder.ChildCount)}