forked from TrueCloudLab/rclone
drive, acd, onedrive: Cache the directory IDs when reading the parent directory
This makes directory listings much more efficient (one less transaction needed) and also fixes #1439 (which was caused by having to look up a directory name with quotes in which isn't dealt with well by the list routine) by not doing a directory lookup at all.
This commit is contained in:
parent
a5cfdfd233
commit
3fe9448229
3 changed files with 6 additions and 0 deletions
|
@ -405,6 +405,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
|
|||
switch *node.Kind {
|
||||
case folderKind:
|
||||
if out.IncludeDirectory(remote) {
|
||||
// cache the directory ID for later lookups
|
||||
f.dirCache.Put(remote, *node.Id)
|
||||
dir := &fs.Dir{
|
||||
Name: remote,
|
||||
Bytes: -1,
|
||||
|
|
|
@ -564,6 +564,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
|
|||
// ignore object or directory
|
||||
case item.MimeType == driveFolderType:
|
||||
if out.IncludeDirectory(remote) {
|
||||
// cache the directory ID for later lookups
|
||||
f.dirCache.Put(remote, item.Id)
|
||||
dir := &fs.Dir{
|
||||
Name: remote,
|
||||
Bytes: -1,
|
||||
|
|
|
@ -406,6 +406,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
|
|||
remote := job.Path + info.Name
|
||||
if info.Folder != nil {
|
||||
if out.IncludeDirectory(remote) {
|
||||
// cache the directory ID for later lookups
|
||||
f.dirCache.Put(remote, info.ID)
|
||||
dir := &fs.Dir{
|
||||
Name: remote,
|
||||
Bytes: -1,
|
||||
|
|
Loading…
Reference in a new issue