PollingOutcome

sealed class PollingOutcome<out T>

Terminal outcome of a polling session.

Use exhaustive when to handle all cases:

when (outcome) { is PollingOutcome.Success -> { /* use outcome.value / } is PollingOutcome.Exhausted -> { / retries ended without success / } is PollingOutcome.Timeout -> { / overall timeout exceeded / } is PollingOutcome.Cancelled -> { / cancelled by user/system */ } }

Inheritors

Types

Link copied to clipboard
data class Cancelled(val attempts: Int, val elapsedMs: Long) : PollingOutcome<Nothing>

Cancelled externally or due to scope cancellation.

Link copied to clipboard
data class Exhausted(val last: PollingResult<*>?, val attempts: Int, val elapsedMs: Long) : PollingOutcome<Nothing>

Attempts exhausted or retry predicate returned false on last error.

Link copied to clipboard
data class Success<T>(val value: T, val attempts: Int, val elapsedMs: Long) : PollingOutcome<T>

Terminal success with the last successful value.

Link copied to clipboard
data class Timeout(val attempts: Int, val elapsedMs: Long) : PollingOutcome<Nothing>

Overall timeout reached.