Repository navigation
samples(Storage): add Storage Control Rapid Cache samples - #3353
Conversation
Adds create, get, list, update and disable Rapid Cache samples for Storage Control, with a (skipped by default) integration test. Bumps Google.Cloud.Storage.Control.V2 to 1.11.0. b/482946642 [Generated-by: AI]
There was a problem hiding this comment.
Code Review
This pull request upgrades the Google.Cloud.Storage.Control.V2 package to version 1.11.0 and introduces code samples and integration tests for managing the Rapid Cache lifecycle, including creation, retrieval, listing, updating, and disabling. The review feedback highlights two important improvements in the test suite: adding a safety guard when parsing the region from the zone string to prevent an ArgumentOutOfRangeException, and registering the newly created bucket in the test fixture's temporary bucket collection immediately after creation to avoid resource leaks if the test is aborted.
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]
Guard zone-to-region parsing when the zone has no hyphen, and register the test bucket in the fixture right after creation so it is cleaned up even if the test aborts. [Generated-by: AI]
…rdown - Create sample sets only name, zone and cache type (rapid-cache-ultra); TTL is left to the update sample, matching AnywhereCacheCreate. - Use a rapidCacheId variable in the create sample, consistent with Get/Update/Disable. - Test: linear lifecycle flow with IDisposable teardown that disables the cache if still active (positive _cacheActive flag) and deletes the bucket best-effort; no nested try/catch/finally. Disable wait stays bounded via LRO PollSettings. [Generated-by: AI]
|
Here is the summary of changes. You are about to add 5 region tags.
This comment is generated by snippet-bot.
|
- Disable starts the operation, prints its name and returns it instead of waiting; the test polls Get until the state is "disabled". - Create no longer sets the cache name; the server derives it from the bucket and zone. - List returns the PagedEnumerable directly and accepts a page size. - Get/Update/Disable default the cache ID to the zone "us-central1-a". - Test uses the fixture sleep after bucket creation and relies on the fixture for bucket cleanup. [Generated-by: AI]
Summary
Adds Storage Control Rapid Cache samples for .NET (
storage/api/Storage.Samples):storage_control_create_rapid_cacheStorageControlCreateRapidCache.csstorage_control_get_rapid_cacheStorageControlGetRapidCache.csstorage_control_list_rapid_cachesStorageControlListRapidCaches.csstorage_control_update_rapid_cacheStorageControlUpdateRapidCache.csstorage_control_disable_rapid_cacheStorageControlDisableRapidCache.csAlso bumps
Google.Cloud.Storage.Control.V2from 1.8.0 to 1.11.0, the first release that includes the Rapid Cache APIs.Behavior notes
parent,zoneandcache_type = "rapid-cache-ultra". It does not set a name: the server derives it from the bucket and zone (projects/_/buckets/{bucket}/rapidCaches/{zone}), as in the Anywhere Cache create sample. It waits for the operation and prints the returned name and state.rapidCacheId, which is the cache's zone; the default is"us-central1-a".pageSize(default 10), shows item-by-item and page-by-page iteration, and returns thePagedEnumerabledirectly.ttlto 172800s with update mask["ttl"].Operation. It does not wait: the cache moves todisabledwithin seconds, but the operation only completes once the cache is fully removed, which can take more than an hour. Callers can useStorageControlGetRapidCacheto check for thedisabledstate.Tests
Storage.Samples.Tests/StorageControlRapidCacheTest.csruns the full lifecycle: create, get, list, update, then disable and poll Get (up to 12 × 10s) until the state isdisabled. It uses a regional HNS + UBLA bucket in the zone's region, with the standard fixture sleep after bucket creation. The zone defaults tous-central1-aand can be overridden with theRAPID_CACHE_ZONEenv var.[Fact(Skip = ...)]by default. Rapid Cache needs an allowlisted project, and Anywhere Cache, the closest precedent, has no CI tests in this repo either.TempBucketNames). Deleting the bucket returns409until the disabled cache is fully removed, so the bucket may need to be deleted manually later.Internal bug: b/482946642