Repository navigation
docs(storage): add Rapid Cache samples - #7346
sahusneha2004 wants to merge 6 commits into
Conversation
Adds create, get, list, update and disable Rapid Cache samples for Storage Control, with an integration test gated behind skipped-integration-tests. b/482946642 [Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request introduces support and examples for managing Rapid Caches in the Google Cloud Storage Control service. It adds new modules and sample code for creating, disabling, getting, listing, and updating rapid caches. Additionally, it integrates these examples into the integration test suite and updates the bucket cleanup logic to handle rapid caches. I have no feedback to provide as there are no review comments and the implementation is clean.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7346 +/- ##
=======================================
Coverage 98.64% 98.65%
=======================================
Files 334 334
Lines 145750 145750
=======================================
+ Hits 143780 143786 +6
+ Misses 1970 1964 -6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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 googleapis/google-cloud-java#14529. b/482946642 [Generated-by: AI]
Set only name, zone, and cache type on create, like the anywhere cache create sample. The TTL is changed by the update sample. Use cache_id in the create sample, and make the test flow linear: return early if create fails, otherwise always disable the cache with a bounded wait. [Generated-by: AI]
joshuatants
left a comment
There was a problem hiding this comment.
Left a few small suggestions, otherwise LGTM.
xlai20
left a comment
There was a problem hiding this comment.
Could you pls fix @joshuatants 's feedback before merging? Thanks!
The DisableRapidCache operation completes only after the cache is fully removed, which can take over an hour. The cache state changes to "disabled" within seconds. The disable sample now starts the operation and returns without waiting, and the test polls the cache state with a 60s bound. Also use the shared bucket cleanup helper and remove an unneeded 20s sleep before creating the cache. [Generated-by: AI]
Adds Storage Control samples for Rapid Cache: create, get, list, update (TTL through a
FieldMask), and disable.Region tags:
storage_control_create_rapid_cachestorage_control_get_rapid_cachestorage_control_list_rapid_cachesstorage_control_update_rapid_cachestorage_control_disable_rapid_cacheNotes:
createusescache_type = "rapid-cache-ultra"and does not set a name. The service assigns the cache ID, so the driver finds it by listing caches and parsing the name.disablestarts the long-running operation and does not wait for it. The cache reaches thedisabledstate within seconds, but the operation only completes once the cache is fully removed, which can take more than 30 minutes. The driver pollsget_rapid_cacheuntil the state isdisabled.{:?}, to match the samples in other languages.GOOGLE_CLOUD_RUST_TEST_ZONE(defaultus-central1-a).rapid_cache_examplesintegration test is gated behindskipped-integration-tests, like the Anywhere Cache examples.FAILED_PRECONDITION("The bucket you tried to delete has Rapid Cache Ultra") for a long time after the cache is disabled. The test retries for about 2 minutes, then leaves the bucket for the stale bucket cleanup, which now also disables rapid caches.google-cloud-storage1.21.0.Testing:
cargo fmt --checkandcargo clippy --all-targets --all-features -- --deny warningspass. I also ran the full integration test once against a live project:Internal bug: b/482946642
Update: aligned with googleapis/google-cloud-java#14529
The samples and the test now follow the reference integration test (
ITRapidCacheTest.java). This replaces thecreateanddisablenotes above.create: sets the cache name explicitly (projects/_/buckets/{bucket}/rapidCaches/{zone}; the backend requires the cache ID to equal the zone), withcache_type = "rapid-cache-ultra"and a 24h TTL (86400s).disable: now waits for the long-running operation with.poller().until_done()instead of returning right away.cache_id = zone(no more listing to find the service-assigned ID), and checks that the cache isrunningwith the right cache type after create, that list returns it, and that the TTL is 172800s after update.tokio::time::timeout(600s). If it times out, it callsget_rapid_cacheand accepts thedisabledstate, so the test never hangs.Testing:
cargo fmt --check,cargo clippy -p storage-samples --all-targets --all-features -- --deny warnings, and one live run ofrapid_cache_examples(passed; the disable operation hit the 600s timeout and the cache state wasdisabled).