mirror of
https://github.com/InsanusMokrassar/TelegramBotApiLibraries.git
synced 2024-06-01 15:05:13 +00:00
24 lines
628 B
Kotlin
24 lines
628 B
Kotlin
package dev.inmo.tgbotapi.libraries.fsm.core
|
|
|
|
import kotlinx.coroutines.sync.Mutex
|
|
|
|
interface StatesQuotaManager {
|
|
suspend fun <T : State, O : State> doOnQuota(state: T, block: suspend (T) -> O?): O?
|
|
|
|
suspend fun transitQuota(from: State, to: State?)
|
|
}
|
|
|
|
class InMemoryStatesQuotaManager : StatesQuotaManager {
|
|
private val currentContextsAndStates = mutableMapOf<Any, State>()
|
|
|
|
private val mutex = Mutex()
|
|
|
|
override suspend fun <T : State, O : State> doOnQuota(state: T, block: suspend (T) -> O?): O? {
|
|
|
|
}
|
|
|
|
override suspend fun transitQuota(state: State) {
|
|
TODO("Not yet implemented")
|
|
}
|
|
}
|