[Storage] Implement List API across Android, iOS, and Desktop#1841
[Storage] Implement List API across Android, iOS, and Desktop#1841AustinBenoit wants to merge 13 commits intomainfrom
Conversation
Added the paginated `List` API to the Firebase Storage C++ SDK. - Android: Interoperates via JNI with `com/google/firebase/storage/ListResult`. - iOS: Connects to `FIRStorageListOptions` and `FIRStorageListResult` using Objective-C. - Desktop: Uses the Firebase Storage REST API `o` endpoint to retrieve folder prefixes and files. Included integration tests to verify successful nested directory creation, listing results, and pagination via `page_token`. Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces the Storage List API, providing a consistent way to list files and folders within Firebase Storage across Android, iOS, and Desktop platforms. The changes include platform-specific implementations and a unified interface for retrieving and parsing list results, along with comprehensive integration tests to validate the functionality. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
| public: | ||
| StorageListResult(); | ||
| ~StorageListResult(); | ||
| StorageListResult(const StorageListResult& other); |
There was a problem hiding this comment.
📝 Documentation issue: warning: Member StorageListResult(const StorageListResult &other) (function) of class firebase::storage::StorageListResult is not documented.
| StorageListResult(); | ||
| ~StorageListResult(); | ||
| StorageListResult(const StorageListResult& other); | ||
| StorageListResult& operator=(const StorageListResult& other); |
There was a problem hiding this comment.
📝 Documentation issue: warning: Member operator=(const StorageListResult &other) (function) of class firebase::storage::StorageListResult is not documented.
| StorageListResult& operator=(const StorageListResult& other); | ||
|
|
||
| #if defined(FIREBASE_USE_MOVE_OPERATORS) || defined(DOXYGEN) | ||
| StorageListResult(StorageListResult&& other); |
There was a problem hiding this comment.
📝 Documentation issue: warning: Member StorageListResult(StorageListResult &&other) (function) of class firebase::storage::StorageListResult is not documented.
|
|
||
| #if defined(FIREBASE_USE_MOVE_OPERATORS) || defined(DOXYGEN) | ||
| StorageListResult(StorageListResult&& other); | ||
| StorageListResult& operator=(StorageListResult&& other); |
There was a problem hiding this comment.
📝 Documentation issue: warning: Member operator=(StorageListResult &&other) (function) of class firebase::storage::StorageListResult is not documented.
| Future<Metadata> PutFileLastResult(); | ||
|
|
||
| // Android's maximum limit is 1000, so use this as the default max results. | ||
| static const int kDefaultListMaxResultsPerPage = 1000; |
There was a problem hiding this comment.
📝 Documentation issue: warning: Member kDefaultListMaxResultsPerPage (variable) of class firebase::storage::StorageReference is not documented.
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
There was a problem hiding this comment.
Code Review
This pull request implements the Storage List API across Android, iOS, and Desktop platforms, along with corresponding integration tests. The implementation looks solid and covers the required functionality. I've provided a few suggestions to improve performance by using move semantics when constructing result objects, which avoids unnecessary data copying. I also pointed out a piece of dead code in the desktop implementation that can be removed for better code clarity. Overall, great work on implementing this feature across all platforms.
| StorageListResultInternal* list_internal = | ||
| new StorageListResultInternal(prefixes, items, page_token); |
There was a problem hiding this comment.
To improve performance, use std::move to transfer ownership of the local variables to the StorageListResultInternal constructor. This avoids unnecessary copies of the vectors and the string, as they are no longer needed in this scope. I've made a related suggestion to update the constructor to take advantage of this.
StorageListResultInternal* list_internal =
new StorageListResultInternal(std::move(prefixes), std::move(items), std::move(page_token));| StorageListResultInternal(const std::vector<StorageReference>& prefixes, | ||
| const std::vector<StorageReference>& items, | ||
| const std::string& next_page_token) | ||
| : prefixes_(prefixes), items_(items), next_page_token_(next_page_token) {} |
There was a problem hiding this comment.
This constructor copies its arguments, which can be inefficient. Since the call sites are passing temporary local variables, it's better to move the data instead of copying it. By changing the constructor to take its arguments by value, you can then use std::move to efficiently transfer ownership to the member variables. This is known as the 'pass-by-value and move' idiom.
| StorageListResultInternal(const std::vector<StorageReference>& prefixes, | |
| const std::vector<StorageReference>& items, | |
| const std::string& next_page_token) | |
| : prefixes_(prefixes), items_(items), next_page_token_(next_page_token) {} | |
| StorageListResultInternal(std::vector<StorageReference> prefixes, | |
| std::vector<StorageReference> items, | |
| std::string next_page_token) | |
| : prefixes_(std::move(prefixes)), items_(std::move(items)), next_page_token_(std::move(next_page_token)) {} |
|
|
||
| StorageListResultInternal* list_internal = |
There was a problem hiding this comment.
To improve performance, use std::move to transfer ownership of the local variables to the StorageListResultInternal constructor. This avoids unnecessary copies of the vectors and the string, as they are no longer needed in this scope. I've made a related suggestion to update the constructor to take advantage of this.
| StorageListResultInternal* list_internal = | |
| StorageListResultInternal* list_internal = | |
| new StorageListResultInternal(std::move(prefixes), std::move(items), std::move(next_page_token)); |
| // List operation without metadata. | ||
| Future<StorageListResult> ListInternal(int max_results_per_page, | ||
| const char* page_token); |
| StorageListResultInternal* list_internal = | ||
| new StorageListResultInternal(prefixes, items, next_page_token); |
There was a problem hiding this comment.
To improve performance, use std::move to transfer ownership of the local variables to the StorageListResultInternal constructor. This avoids unnecessary copies of the vectors and the string, as they are no longer needed in this scope. I've made a related suggestion to update the constructor to take advantage of this.
StorageListResultInternal* list_internal =
new StorageListResultInternal(std::move(prefixes), std::move(items), std::move(next_page_token));
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
…RATORS Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Co-authored-by: AustinBenoit <22805659+AustinBenoit@users.noreply.github.com>
Implements the Storage List API per the requirements. All platforms correctly return a Future representing a StorageListResult, and parsing logic is complete. Tested extensively in integration_tests.
PR created automatically by Jules for task 15739532705466063966 started by @AustinBenoit