You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I should note that the doc for the new File.update method no longer lists the newRevision optional query parameter, and there's also no mention about whether it adds a new revision for existing files like the previous API.
I haven't tested the new API yet, but if it doesn't add a revision this would lead to a behaviour change.
Nick, is the Google Drive API in the betas now at v3? I am using the beta successfully with Team Drives, and it's unclear to me from the google docs if Team Drives formally depend on v3.
Since the change to API v3 there is a API call to the About service to get the exportFormats in drive.go#L533.
I was thinking about ways to get rid of this call, as it slows down NewFS.
One method i could find was B4dM4n/rclone@58fa712:
diff --git a/backend/drive/drive.go b/backend/drive/drive.go
index f81e98f9..de1642b1 100644
--- a/backend/drive/drive.go+++ b/backend/drive/drive.go@@ -530,15 +530,19 @@ func NewFs(name, path string) (fs.Fs, error) {
f.dirCache = dircache.New(root, f.rootFolderID, f)
- var about *drive.About- err = f.pacer.Call(func() (bool, error) {- about, err = f.svc.About.Get().Fields("exportFormats").Do()- return shouldRetry(err)- })- if err != nil {- return nil, errors.Wrap(err, "couldn't get Drive exportFormats")+ if !*driveSkipGdocs {+ var about *drive.About+ err = f.pacer.Call(func() (bool, error) {+ about, err = f.svc.About.Get().Fields("exportFormats").Do()+ return shouldRetry(err)+ })+ if err != nil {+ return nil, errors.Wrap(err, "couldn't get Drive exportFormats")+ }+ f.exportFormats = about.ExportFormats+ } else {+ fs.Debugf(f, "Skipping google documents")
}
- f.exportFormats = about.ExportFormats
// Parse extensions
err = f.parseExtensions(*driveExtensions)
This change would make the call depended on the driveSkipGdocs flag, which is false by default, so most users won't benefit from it.
To completely get rid of it we would have to put the exportFormats in the source.
It could be half automated using a go generate script or a make rule, but this would need a configured drive remote to work.
Would removing one call during NewFS be worth the effort?
I should note that the doc for the new File.update method no longer lists the newRevision optional query parameter, and there's also no mention about whether it adds a new revision for existing files like the previous API.
It does create new revisions - I checked, so this behaviour hasn't changed.
Would removing one call during NewFS be worth the effort?
I think so...
This change would make the call depended on the driveSkipGdocs flag, which is false by default, so most users won't benefit from it.
I was thinking about the same thing, but my idea was to do the About call in a function wrapped in a sync.Once, so just call this setupExports (or whatever) function just before exports are needed. This then gets rid of the cost for all users which don't have any Gdocs in their remote (or in the part of it that is being listed).
To completely get rid of it we would have to put the exportFormats in the source.
It could be half automated using a go generate script or a make rule, but this would need a configured drive remote to work.
I think that is probably a step too far as we'd then need to release a new rclone if Google change the formats
We could cache it on disk. Rclone now has a place to cache things... We'd need to update it when it got old so that is still quite a lot of work.
I think the just-in-time API call approach is probably the best - what do you think? Would that work out?
Activity
gustavorochakv commentedon Jan 26, 2016
I should note that the doc for the new File.update method no longer lists the newRevision optional query parameter, and there's also no mention about whether it adds a new revision for existing files like the previous API.
I haven't tested the new API yet, but if it doesn't add a revision this would lead to a behaviour change.
ncw commentedon Jan 28, 2016
@gustavorochakv thanks for the heads up.
rwaldspur commentedon Jun 29, 2017
Nick, is the Google Drive API in the betas now at v3? I am using the beta successfully with Team Drives, and it's unclear to me from the google docs if Team Drives formally depend on v3.
ncw commentedon Jun 30, 2017
No it is still on v2. Google have updated the v2 API to work with Team Drives.
Cubox commentedon Aug 1, 2017
I am willing to try and see what needs to be done in order to convert to v3. The changed APIs and parameters are listed here: https://developers.google.com/drive/v3/web/migration
B4dM4n commentedon Jan 29, 2018
Since the change to API v3 there is a API call to the About service to get the
exportFormatsin drive.go#L533.I was thinking about ways to get rid of this call, as it slows down
NewFS.One method i could find was B4dM4n/rclone@58fa712:
This change would make the call depended on the driveSkipGdocs flag, which is false by default, so most users won't benefit from it.
To completely get rid of it we would have to put the exportFormats in the source.
It could be half automated using a
go generatescript or a make rule, but this would need a configured drive remote to work.Would removing one call during
NewFSbe worth the effort?ncw commentedon Jan 30, 2018
@gustavorochakv wrote:
It does create new revisions - I checked, so this behaviour hasn't changed.
ncw commentedon Jan 30, 2018
@B4dM4n wrote:
I think so...
I was thinking about the same thing, but my idea was to do the About call in a function wrapped in a sync.Once, so just call this
setupExports(or whatever) function just before exports are needed. This then gets rid of the cost for all users which don't have any Gdocs in their remote (or in the part of it that is being listed).I think that is probably a step too far as we'd then need to release a new rclone if Google change the formats
We could cache it on disk. Rclone now has a place to cache things... We'd need to update it when it got old so that is still quite a lot of work.
I think the just-in-time API call approach is probably the best - what do you think? Would that work out?
vfs: make -ve sized files appear as 0 size. #320
operations: ignore size of objects when they are < 0 #320
drive: request the export formats only when required #320
drive: request the export formats only when required #320
ncw commentedon Mar 16, 2018
I think this is all done now - thanks @B4dM4n for all your help :-)
vfs: make -ve sized files appear as 0 size. rclone#320
operations: ignore size of objects when they are < 0 rclone#320
drive: request the export formats only when required rclone#320