"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
mountlib: add parent and entry to Dir
Nick Craig-Woodc6cd2a528061
diff --git a/cmd/mountlib/dir.go b/cmd/mountlib/dir.goindex d2d1b5da3..b35418aaf 100644--- a/cmd/mountlib/dir.go+++ b/cmd/mountlib/dir.go@@ -24,17 +24,21 @@ type Dir struct {fsys *FSinode uint64 // inode numberf fs.Fs+ parent *Dir // parent, nil for rootpath stringmodTime time.Time+ entry fs.Directorymu sync.Mutex // protects the followingread time.Time // time directory entry last readitems map[string]*DirEntry // NB can be nil when directory not read yet}-func newDir(fsys *FS, f fs.Fs, fsDir fs.Directory) *Dir {+func newDir(fsys *FS, f fs.Fs, parent *Dir, fsDir fs.Directory) *Dir {return &Dir{fsys: fsys,f: f,+ parent: parent,+ entry: fsDir,path: fsDir.Remote(),modTime: fsDir.ModTime(),inode: NewInode(),@@ -138,6 +142,8 @@ func (d *Dir) walk(absPath string, fun func(*Dir)) {// reading everything againfunc (d *Dir) rename(newParent *Dir, fsDir fs.Directory) {d.ForgetAll()+ d.parent = newParent+ d.entry = fsDird.path = fsDir.Remote()d.modTime = fsDir.ModTime()d.read = time.Time{}@@ -219,7 +225,7 @@ func (d *Dir) _readDir() error {}d.items[name] = &DirEntry{Obj: dir,- Node: newDir(d.fsys, d.f, dir),+ Node: newDir(d.fsys, d.f, d, dir),}default:err = errors.Errorf("unknown type %T", item)@@ -350,7 +356,7 @@ func (d *Dir) Mkdir(name string) (*Dir, error) {return nil, err}fsDir := fs.NewDir(path, time.Now())- dir := newDir(d.fsys, d.f, fsDir)+ dir := newDir(d.fsys, d.f, d, fsDir)d.addObject(fsDir, dir)// fs.Debugf(path, "Dir.Mkdir OK")return dir, nildiff --git a/cmd/mountlib/fs.go b/cmd/mountlib/fs.goindex e00a691f6..125079241 100644--- a/cmd/mountlib/fs.go+++ b/cmd/mountlib/fs.go@@ -69,7 +69,7 @@ func NewFS(f fs.Fs) *FS {}fsys.dirCacheTime = DirCacheTime- fsys.root = newDir(fsys, f, fsDir)+ fsys.root = newDir(fsys, f, nil, fsDir)if PollInterval > 0 {fsys.PollChanges(PollInterval)