MutationQueue

constructor(apiClient: ApiClient, scope: CoroutineScope, store: MutationStore = InMemoryMutationStore(), defaultRetryPolicy: RetryPolicy = DefaultRetryPolicy(retryNonIdempotent = true), maxStatuses: Int = 64, codecs: List<MutationCodec<*>> = emptyList())

Parameters

apiClient

executes the underlying HTTP calls.

scope

owns every mutation's execution + retry backoff; mutations outlive the caller's own scope (e.g. a ViewModel's) as long as this scope is alive.

store

where enqueued mutations (that were given a MutationCodec) are persisted.

defaultRetryPolicy

applied to mutations enqueued without an explicit retryPolicy. Defaults to retrying non-idempotent methods too — the whole point of this queue is to make POST/PATCH mutations retryable — unlike DefaultRetryPolicy's own conservative default.

maxStatuses

maximum number of status flows to retain per queue instance. When exceeded, the least-recently-accessed entries are evicted. Must be positive. Defaults to 64.

codecs

MutationCodecs to register upfront, so restore can decode their records even before any matching enqueue call runs in this process. Enqueueing with a new codec also registers it.