mirror of
https://github.com/rclone/rclone.git
synced 2025-02-22 18:48:38 +08:00
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
@ -405,6 +405,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
|
|||||||
switch *node.Kind {
|
switch *node.Kind {
|
||||||
case folderKind:
|
case folderKind:
|
||||||
if out.IncludeDirectory(remote) {
|
if out.IncludeDirectory(remote) {
|
||||||
|
// cache the directory ID for later lookups
|
||||||
|
f.dirCache.Put(remote, *node.Id)
|
||||||
dir := &fs.Dir{
|
dir := &fs.Dir{
|
||||||
Name: remote,
|
Name: remote,
|
||||||
Bytes: -1,
|
Bytes: -1,
|
||||||
|
@ -564,6 +564,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
|
|||||||
// ignore object or directory
|
// ignore object or directory
|
||||||
case item.MimeType == driveFolderType:
|
case item.MimeType == driveFolderType:
|
||||||
if out.IncludeDirectory(remote) {
|
if out.IncludeDirectory(remote) {
|
||||||
|
// cache the directory ID for later lookups
|
||||||
|
f.dirCache.Put(remote, item.Id)
|
||||||
dir := &fs.Dir{
|
dir := &fs.Dir{
|
||||||
Name: remote,
|
Name: remote,
|
||||||
Bytes: -1,
|
Bytes: -1,
|
||||||
|
@ -406,6 +406,8 @@ func (f *Fs) ListDir(out fs.ListOpts, job dircache.ListDirJob) (jobs []dircache.
|
|||||||
remote := job.Path + info.Name
|
remote := job.Path + info.Name
|
||||||
if info.Folder != nil {
|
if info.Folder != nil {
|
||||||
if out.IncludeDirectory(remote) {
|
if out.IncludeDirectory(remote) {
|
||||||
|
// cache the directory ID for later lookups
|
||||||
|
f.dirCache.Put(remote, info.ID)
|
||||||
dir := &fs.Dir{
|
dir := &fs.Dir{
|
||||||
Name: remote,
|
Name: remote,
|
||||||
Bytes: -1,
|
Bytes: -1,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user