UserStateStore

interface UserStateStore

Stores per-chat FSM state.

update is only ever called by Telek, through its internal per-chat actor (ChatWorkers), which guarantees that at most one update call for a given chatId is in flight at any time, in the order the corresponding inputs were received. Implementations do not need to — and should not — serialize update internally with their own per-chat locking: that duplicates a guarantee the caller already provides, and doing it locally is easy to get subtly wrong (e.g. reading state before acquiring a lock, or leaking a lock/mutex map that's never cleaned up).

Inheritors

Functions

Link copied to clipboard
abstract suspend fun clear(chatId: Long)
Link copied to clipboard
abstract suspend fun get(chatId: Long): State?
Link copied to clipboard
abstract suspend fun update(chatId: Long, block: suspend (State?) -> UpdateResult): UpdateResult