Skip to content

docs(storage): add Rapid Cache samples - #14886

Open
sahusneha2004 wants to merge 5 commits into
mainfrom
storage-control-rapid-cache-samples-java
Open

sahusneha2004 wants to merge 5 commits into
mainfrom
storage-control-rapid-cache-samples-java

Conversation

@sahusneha2004

@sahusneha2004 sahusneha2004 commented Nov 2, 2026 •

Copy link
Copy Markdown

Adds Storage Control Rapid Cache samples for Java:

Sample Region tag
RapidCacheCreate storage_control_create_rapid_cache
RapidCacheGet storage_control_get_rapid_cache
RapidCacheList storage_control_list_rapid_caches
RapidCacheUpdate storage_control_update_rapid_cache
RapidCacheDisable storage_control_disable_rapid_cache

Notes:

  • Create uses cache_type = "rapid-cache-ultra" and does not set a name; the server assigns the cache ID (currently equal to the zone).
  • Update sets ttl = 172800s with update mask ["ttl"].
  • Disable starts the LRO and prints the operation name without waiting: the cache enters the disabled state within seconds, but the operation only completes once the cache is fully removed (can take more than 30 minutes).
  • Bumps libraries-bom 26.78.0 → 26.90.0 (google-cloud-storage-control 2.75.0, which includes RapidCache), and the matching google-cloud-storage versions (tests jar and install-without-bom) 2.64.0 → 2.75.0.

Testing:

  • ITRapidCacheTest runs create → get → list → update, then disable in finally, and polls get until the state is disabled. It uses a regional HNS + UBLA bucket in the zone's region. Zone defaults to us-central1-a and can be overridden with RAPID_CACHE_ZONE.
  • Like ITAnywhereCacheTest, the test is skipped in CI (JOB_TYPE set) because of the long operation times. It passed when run locally against an allowlisted project.
  • Bucket cleanup is best-effort: deleting the bucket returns 409 ("The bucket you tried to delete has Rapid Cache Ultra") for a long time after disable, so the test retries for about 2 minutes and then leaves the bucket for the stale-bucket cleanup.

b/482946642

[Generated-by: AI]

Update: aligned with #14529

The samples now match the API usage in the reference integration test (ITRapidCacheTest in #14529). Where this section differs from the notes above, this section is current.

Samples:

  • RapidCacheCreate: sets the name explicitly to projects/_/buckets/{bucket}/rapidCaches/{zone} (the backend requires the cache ID to equal the zone), plus zone, cache_type = "rapid-cache-ultra" and ttl = 86400s (24h). Prints the name, cache type and state.
  • RapidCacheGet: also prints the cache type.
  • RapidCacheDisable: now waits for the LRO (disableRapidCacheAsync(request).get()) and prints the result, the same as the reference. A comment explains that the cache is disabled within seconds, but full removal can take longer than the client's default polling timeout (5 minutes).
  • Region tags are unchanged.

Test (ITRapidCacheTest):

  • Waits 20s after creating the HNS + UBLA bucket so its metadata can propagate.
  • Uses cache ID = zone and checks the exact cache name.
  • Create: checks the cache type. Get: checks State: running and the cache type. List: checks that the cache is listed. Update: checks TTL: 172800 seconds.
  • Disable: runs the sample with a 10-minute limit. If the wait times out, or the client stops polling (CancellationException), the test checks that get shows State: disabled and does not fail.
  • Teardown: if the test did not disable the cache, it starts a disable and ignores errors. It then tries to delete the bucket and logs the name of any bucket it leaves behind.
  • CI skip (JOB_TYPE) and zone default/override are unchanged.
  • Passed in a live run against an allowlisted project (about 7.5 min).

Adds create, get, list, update and disable Rapid Cache samples for Storage Control, with an integration test. Bumps libraries-bom to 26.90.0 (storage-control 2.75.0 with RapidCache). b/482946642

[Generated-by: AI]
@sahusneha2004 sahusneha2004 added ai-generated Pull Request generated by AI storage-sample-architect Generated by storage-sample-architect skill labels Nov 2, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces code snippets and integration tests for managing Rapid Cache in Google Cloud Storage Control v2, including creation, retrieval, listing, updating, and disabling operations, alongside updating the necessary Maven dependencies. The review feedback focuses on improving the robustness and readability of the integration tests by moving the Rapid Cache disabling logic into the tearDown method, declaring cacheId as an instance field, and simplifying the test flow by removing the complex manual try-catch-finally block.

Set the explicit cache name (ID = zone), cache_type rapid-cache-ultra and ttl 24h on create; wait for the disable LRO; tests assert running state, cache type, list membership and the updated ttl, and bound the disable wait. Aligns with #14529. b/482946642

[Generated-by: AI]
@sahusneha2004 sahusneha2004 changed the title feat(storage): add Rapid Cache samples docs(storage): add Rapid Cache samples Nov 2, 2026

@nidhiii-27 nidhiii-27 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please regenerate java-storage/README.md via librarian generate — this is critical so merging the PR does not break the post-submit Librarian - Generate libraries check on main.

Comment thread java-storage/samples/snippets/pom.xml Resolved
Revert the samples pom.xml changes (managed automatically), rename the
create sample's zoneName parameter to cacheId, call the disable sample
directly in the test and handle the polling timeout
(CancellationException), use a positive cacheActive flag, and regenerate
java-storage/README.md with librarian. b/482946642

[Generated-by: AI]
@sahusneha2004

Copy link
Copy Markdown
Author

Thanks Nidhi! I regenerated java-storage/README.md with librarian generate (librarian v0.50.0, the version pinned in librarian.yaml), so it now lists the new Rapid Cache samples.

Co-authored by AI Agent

@sahusneha2004
sahusneha2004 marked this pull request as ready for review November 6, 2026 10:14
@sahusneha2004
sahusneha2004 requested review from a team as code owners November 6, 2026 10:14
@snippet-bot

snippet-bot Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Here is the summary of changes.

You are about to add 5 region tags.

This comment is generated by snippet-bot.
If you find problems with this result, please file an issue at:
https://github.com/googleapis/repo-automation-bots/issues.
To update this comment, add snippet-bot:force-run label or use the checkbox below:

  • Refresh this comment

Match AnywhereCacheCreate by setting only the required fields (name, zone, cache type) on create. RapidCacheUpdate shows how to configure the TTL. Clarify that the disable sample's get() throws CancellationException on client polling timeout. b/482946642

[Generated-by: AI]

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-generated Pull Request generated by AI storage-sample-architect Generated by storage-sample-architect skill

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants