Repository navigation
docs(storage): add Rapid Cache samples - #14886
sahusneha2004 wants to merge 5 commits into
Conversation
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]
There was a problem hiding this comment.
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]
nidhiii-27
left a comment
There was a problem hiding this comment.
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.
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]
|
Thanks Nidhi! I regenerated java-storage/README.md with Co-authored by AI Agent |
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]
Adds Storage Control Rapid Cache samples for Java:
RapidCacheCreatestorage_control_create_rapid_cacheRapidCacheGetstorage_control_get_rapid_cacheRapidCacheListstorage_control_list_rapid_cachesRapidCacheUpdatestorage_control_update_rapid_cacheRapidCacheDisablestorage_control_disable_rapid_cacheNotes:
cache_type = "rapid-cache-ultra"and does not set a name; the server assigns the cache ID (currently equal to the zone).ttl = 172800swith update mask["ttl"].disabledstate within seconds, but the operation only completes once the cache is fully removed (can take more than 30 minutes).libraries-bom26.78.0 → 26.90.0 (google-cloud-storage-control 2.75.0, which includes RapidCache), and the matching google-cloud-storage versions (tests jar andinstall-without-bom) 2.64.0 → 2.75.0.Testing:
ITRapidCacheTestruns create → get → list → update, then disable infinally, and polls get until the state isdisabled. It uses a regional HNS + UBLA bucket in the zone's region. Zone defaults tous-central1-aand can be overridden withRAPID_CACHE_ZONE.ITAnywhereCacheTest, the test is skipped in CI (JOB_TYPEset) because of the long operation times. It passed when run locally against an allowlisted project.b/482946642
[Generated-by: AI]
Update: aligned with #14529
The samples now match the API usage in the reference integration test (
ITRapidCacheTestin #14529). Where this section differs from the notes above, this section is current.Samples:
RapidCacheCreate: sets the name explicitly toprojects/_/buckets/{bucket}/rapidCaches/{zone}(the backend requires the cache ID to equal the zone), pluszone,cache_type = "rapid-cache-ultra"andttl = 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).Test (
ITRapidCacheTest):State: runningand the cache type. List: checks that the cache is listed. Update: checksTTL: 172800 seconds.State: disabledand does not fail.JOB_TYPE) and zone default/override are unchanged.