MutationStore

interface MutationStore

Pluggable persistence for enqueued mutations, keyed by MutationRecord.id.

MutationQueue calls save when a mutation (with a MutationCodec) is enqueued, remove once it reaches a terminal outcome (or is coalesced away by a newer enqueue for the same key), and loadAll on MutationQueue.restore to replay whatever didn't finish before the process died.

InMemoryMutationStore is the shipped default — it does not survive process death. To make queued mutations durable, implement this interface backed by SQLDelight, Room, DataStore, or even a flat file: every MutationRecord field is a primitive/string, so any of those work without extra serialization glue.

Inheritors

Functions

Link copied to clipboard
abstract suspend fun loadAll(): List<MutationRecord>

All currently persisted records, in no particular order.

Link copied to clipboard
abstract suspend fun remove(id: String)

Removes the record with the given id, if present.

Link copied to clipboard
abstract suspend fun save(record: MutationRecord)

Persists (or overwrites) record.