Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support getting full / relative paths from storage.Object #1566

Open
rdjjke opened this issue Sep 25, 2023 · 0 comments
Open

Support getting full / relative paths from storage.Object #1566

rdjjke opened this issue Sep 25, 2023 · 0 comments

Comments

@rdjjke
Copy link
Contributor

rdjjke commented Sep 25, 2023

Files in storages now are represented by storage.Object interface and its storage.LocalObject implementation.

They're usually used in two different scenarious:

  1. Storage implementations provide LocalObjects from ListFolder funcs and in this case objects contain file names in their GetName.
  2. New LocalObjects are created in the other code, for example in storage.ListFolderRecursively*** / multistorage.ListFolderRecursively*** funcs. Such objects may be constructed in a different way, for example, GetName may contain full / relative paths instead of just names.

The problem is that it's not always clear from the code what kind of object in hidden by the storage.Object interface: the original one provided from the storage, or a derivative one, which may contain a path in its GetName.

We should introduce a way to distinguish somehow between these different kinds of objects. The other option, and may be the better one, is to add the new GetPath() func to the storage.Object interface so that we won't need to create new derivative structs implementing storage.Object anywhere outside storage implementations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant