valkum opened a new issue, #511:
URL: https://github.com/apache/arrow-rs-object-store/issues/511

   **Is your feature request related to a problem or challenge? Please describe 
what you are trying to do.**
   <!--
   A clear and concise description of what the problem is. Ex. I'm always 
frustrated when [...] 
   (This section helps Arrow developers understand the context and *why* for 
this feature, in addition to the *what*)
   -->
   I am trying to use the least boilerplate code to copy a subdir from a bucket 
on GCP preserving the "directory" structure.
   The `TryFrom<ListContents> for ObjectMeta` strips trailing `/` from the path 
making it impossible to identify whether an ObjectMeta is a directory or not. 
This requires an extra call to check if the file exists.
   
   Looking at other s3 clients that implement a list operation, e.g. 
https://github.com/rclone/rclone/blob/master/backend/s3/s3.go#L4753, we can see 
that rclone interprets a trailing `/` with size == 0 as a directory marker.
   
   
   **Describe the solution you'd like**
   <!--
   A clear and concise description of what you want to happen.
   -->
   It would be nice if ObjectMeta would provide an `is_directory` flag (or 
Option<bool> for backends that don't emit such "virtual" files) or similar.
   
   There is https://github.com/apache/arrow-rs-object-store/issues/284 without 
any outcome yet.
   
   **Describe alternatives you've considered**
   <!--
   A clear and concise description of any alternative solutions or features 
you've considered.
   -->
   We could use a concrete 
`[GoogleCloudStorage](https://docs.rs/object_store/latest/object_store/gcp/struct.GoogleCloudStorage.html)`
 to use `PaginatedListStore::list_paginated` (which avoids the conversion into 
`ObjectMeta` which would preserve the trailing `/`.
   But we would like to keep supporting `parse_url` and different backends, and 
there is no way to downcast to a concrete store right now.
   
   https://github.com/apache/arrow-rs/issues/7026#issuecomment-2615184698 talks 
about just filtering them out instead of exposing them to the caller.
   
   I am not sure which solution is best. I think exposing an `is_directory` to 
the caller is better because I think a file ending in `/` even with size 0, 
would be a valid file, at least in Google Cloud Storage. But at least the Web 
Console and the gcloud CLI don't let you create such a file. 
   
   **Additional context**
   <!--
   Add any other context or screenshots about the feature request here.
   -->
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to