Skip to content

Conversation

@bajajneha27
Copy link
Contributor

@bajajneha27 bajajneha27 commented Nov 14, 2025

This change introduces support for partial list buckets in both gRPC and JSON transports.

We've introduced a new optional boolean flag, returnPartialSuccess. By default, the flag is false.
If the flag is set to true, the API will return a list of buckets and will additionally populate a separate list of the unreachable bucket names.

@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Nov 14, 2025
@bajajneha27 bajajneha27 added do not merge Indicates a pull request not ready for merge, due to either quality or timing. do not review Indicates a PR is not ready for review and removed api: storage Issues related to the Cloud Storage API. labels Nov 14, 2025
@product-auto-label product-auto-label bot added the api: storage Issues related to the Cloud Storage API. label Nov 15, 2025
@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

❌ Patch coverage is 97.68340% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.94%. Comparing base (4ac3fe1) to head (698f83d).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
...cloud/storage/list_buckets_extended_reader_test.cc 97.16% 3 Missing ⚠️
...e/cloud/storage/examples/storage_bucket_samples.cc 89.47% 2 Missing ⚠️
google/cloud/storage/client.h 94.11% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #15763      +/-   ##
==========================================
- Coverage   92.94%   92.94%   -0.01%     
==========================================
  Files        2457     2458       +1     
  Lines      227084   227342     +258     
==========================================
+ Hits       211066   211299     +233     
- Misses      16018    16043      +25     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@bajajneha27 bajajneha27 marked this pull request as ready for review November 24, 2025 10:41
@bajajneha27 bajajneha27 requested review from a team as code owners November 24, 2025 10:41
@bajajneha27 bajajneha27 removed the do not review Indicates a PR is not ready for review label Nov 24, 2025
@bajajneha27 bajajneha27 removed the do not merge Indicates a pull request not ready for merge, due to either quality or timing. label Nov 25, 2025

if (json.count("unreachable") != 0) {
for (auto const& kv : json["unreachable"].items()) {
result.unreachable.emplace_back(kv.value().get<std::string>());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we use std::move() here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean on kv.value() ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nlohmann_json library may limit the ability to move things. I'm pretty sure value() returns a copy of what the kv iterator is pointing at. However, as result.unreachable is a std::vector<std::string>, emplace_back isn't helping here, push_back(T&&) would be preferable as it will move whatever std::string the json library creates.


std::vector<std::string> names;
std::vector<std::string> unreachable;
for (auto& r : client.ListBucketsExtended(ReturnPartialSuccess(true))) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to add tests for the case where ReturnPartialSuccess is false or empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

By default it's false and we have existing testcase covering that.
If you think we should do it and we're doing it across languages then I can add.


if (json.count("unreachable") != 0) {
for (auto const& kv : json["unreachable"].items()) {
result.unreachable.emplace_back(kv.value().get<std::string>());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nlohmann_json library may limit the ability to move things. I'm pretty sure value() returns a copy of what the kv iterator is pointing at. However, as result.unreachable is a std::vector<std::string>, emplace_back isn't helping here, push_back(T&&) would be preferable as it will move whatever std::string the json library creates.

@bajajneha27 bajajneha27 merged commit b839b6b into googleapis:main Nov 27, 2025
68 of 71 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the Cloud Storage API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants