Open rhunwicks opened 8 months ago
Actually, I see there was already a request for this in #26.
YEs, exactly so - I believe this is well worth adding, but I am unsure how to expose the possibility to users. I believe simply checking all possible drives every time is probably a substantial slowdown, but I am happy to be told otherwise.
@martindurant when you say "checking all possible drives" do you mean in the drives
property, or in _list_directory_by_id
?
I've only just started using gdrivefs, but it seems that you need to specify an exact path from the root folder set in the storage options, so I don't think enabling shared drives universally would be any slower - if you don't set the shared drive folder (or one of its subfolders) as the root_drive_id
in storage_options
then the filesystem won't be searching it.
And the mechanism that finds the exact file id executes one request/response per path segment, so the performance of that seems to be dependent on how many levels deep your path is from the root_folder_id
rather than how many other folders there are that don't match the path.
Currently, gdrivefs doesn't support shared drives.
I have a setup like:
If I attempt to access that file (using commit 2b48baa11d1697401c914e5ff239dbab4d9c8f71), I get the error:
The
root_file_id
is set to the folder id of a GDrive Shared Drive (i.e. https://support.google.com/a/users/answer/7212025?hl=en).As per https://developers.google.com/drive/api/guides/enable-shareddrives#:~:text=The%20supportsAllDrives%3Dtrue%20parameter%20informs,require%20additional%20shared%20drive%20functionality. we need to set
supportsAllDrives=True
andincludeItemsFromAllDrives=True
when callingfiles.list
in order for the API client to find the files.In my case, if I change the existing:
to
(note the change in the call to
self.service.list
)then my code works, and the filesystem can find the file and open it successfully.
I am happy to prepare an MR, but you would need to decide whether you are happy for me to enable shared drive support in all cases, or whether you want to control it via
storage_options
. And if viastorage_options
whether it should default to off (completely backwards compatible) or on (may show new files to existing users with shared drives that they don't currently get returned from gdrivefs).