object UpdateFetchOutcome


Represents the detailed outcome of an update check request.

This class defines constants describing how a request to listAvailableUpdates was satisfied. It is used primarily for telemetry and monitoring, allowing host applications to distinguish between requests served from the local cache, requests that triggered a network fetch, and requests that were throttled or failed.

Host applications receive this outcome in the UpdateCheckTelemetry object passed to UpdateInfoService.onRequestCompleted.

Summary

Nested types

@Retention(value = AnnotationRetention.SOURCE)
@IntDef(value = [1, 3, 4, 2, 5])
annotation UpdateFetchOutcome.Code

Constants

const Int

The request was satisfied immediately from the local cache.

const Int

The request was satisfied from the local cache after waiting for another thread to complete a network fetch.

const Int
FAILED = 5

The operation failed with an exception.

const Int

A network fetch was performed and fresh data was returned.

const Int

The request was blocked by the rate limiter.

Constants

CACHE_HIT

Added in 1.0.0-alpha02
const val CACHE_HIT = 1: Int

The request was satisfied immediately from the local cache.

This outcome occurs when the cached data is considered fresh (e.g., it was last updated within the freshness threshold) and no network locks needed to be acquired. This represents the "Fast Path" for the service.

COALESCED

Added in 1.0.0-alpha02
const val COALESCED = 2: Int

The request was satisfied from the local cache after waiting for another thread to complete a network fetch.

This outcome occurs when multiple clients request updates simultaneously (a "thundering herd"). The current thread waited for the fetchUpdates lock, and by the time it acquired the lock, another thread had already refreshed the cache. This is considered a "Slow Path" outcome due to the lock wait time, even though no network call was made by this specific thread.

FAILED

Added in 1.0.0-alpha02
const val FAILED = 5: Int

The operation failed with an exception.

This outcome occurs if an unhandled exception was thrown during any part of the update check lifecycle (e.g., network failure, disk I/O error, or rate limiter error). The service returned cached data to the client to prevent the crash from propagating.

FETCHED

Added in 1.0.0-alpha02
const val FETCHED = 3: Int

A network fetch was performed and fresh data was returned.

This outcome occurs when the cache was stale, the rate limiter allowed the request, and the UpdateInfoService.fetchUpdates implementation successfully retrieved new data from the backend. This represents the "Slow Path" for the service.

THROTTLED

Added in 1.0.0-alpha02
const val THROTTLED = 4: Int

The request was blocked by the rate limiter.

This outcome occurs when the cache was stale, but the rate limiter determined that a network fetch should not be attempted (e.g., because a check was performed too recently). The service returned cached data to the client to ensure graceful degradation.