Package-level declarations
Types
Link copied to clipboard
object BackoffPolicies
Factory Pattern: predefined BackoffPolicy configurations for common scenarios.
Link copied to clipboard
data class BackoffPolicy(val initialDelayMs: Long = 500, val maxDelayMs: Long, val multiplier: Double = 2.0, val jitterRatio: Double = 0.2, val maxAttempts: Int = 8, val overallTimeoutMs: Long, val perAttemptTimeoutMs: Long? = null, val random: Random = Random.Default)
Configuration for exponential backoff with jitter. Provides validation to ensure safe, production-ready defaults.
Link copied to clipboard
Public facade instance for consumers. Delegates to the internal engine.
Link copied to clipboard
interface PollingApi
Public abstraction layer for consumers. Exposes a small, stable API surface. Internals are delegated to the PollingEngine implementation.
Link copied to clipboard
data class PollingConfig<T>(val fetch: suspend () -> PollingResult<T>, val isTerminalSuccess: (T) -> Boolean, val shouldRetryOnError: (Error?) -> Boolean = { true }, val backoff: BackoffPolicy = BackoffPolicy(), val dispatcher: CoroutineDispatcher = Dispatchers.Default, val onAttempt: (attempt: Int, delayMs: Long?) -> Unit = { _, _ -> }, val onResult: (attempt: Int, result: PollingResult<T>) -> Unit = { _, _ -> }, val onComplete: (attempts: Int, durationMs: Long, outcome: PollingOutcome<T>) -> Unit = { _, _, _ -> }, val throwableMapper: (Throwable) -> Error = { t ->
val msg = t.message ?: (t::class.simpleName ?: "Throwable")
// Use a stable public default code without exposing internal ErrorCodes
Error(-1, msg)
})
Configuration for the polling engine.
Link copied to clipboard
Builder Pattern for creating PollingConfig in a fluent, readable way. Keeps compatibility by producing the existing PollingConfig
Link copied to clipboard
Link copied to clipboard
Represents a running polling session created by the SDK.
Link copied to clipboard
object RetryPredicates
Common retry strategies for polling. Use these to avoid boilerplate and ensure consistency.