Expand description
Tauri commands for bucket listing and region discovery.
§Commands
buckets_list— list buckets for a profile; SWR cache + validation gate.bucket_region_get— get cached region for one bucket; lazy-resolves on miss.
§Validation gate (AC-8 / round-1 finding #9)
Both commands refuse to serve any data when profile.validated_at is None.
The cache itself also enforces this, but the command boundary check is
defence-in-depth: a future refactor of the cache must not silently lift the gate.
§SWR behaviour
- Fresh (within TTL): return cache directly.
- Stale (past TTL, within SWR window): return stale value immediately and spawn a background task that re-fetches and updates the cache.
- Missing: fetch synchronously, store, return.
force = Some(true): bypass cache; fetch synchronously.
§Region discovery
After a successful bucket list, a background task fires GetBucketLocation
for every bucket. Failures are logged as Severity::Warning notifications
and do not fail the command. Each successful discovery updates the cache
and emits a buckets:updated event.
Functions§
- bucket_
region_ get - Return the cached region for
bucket, resolving it lazily on cache miss. - buckets_
list - List all buckets for the given profile.
- push_
bg_ 🔒warning - Push a
Severity::Warningnotification into the log — best-effort. - region_
cache_ 🔒key - revalidate_
buckets 🔒 - Re-fetch the bucket list and update the cache + emit events. Called from the background task spawned on a stale cache hit.
- spawn_
region_ 🔒discovery - Spawn a background task that calls
GetBucketLocationfor every bucket in the list, updating the per-bucket region cache on success and emittingbuckets:updatedper discovery.