All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.dev.inmo.micro_utils.fsm.common.StatesManager.kt Maven / Gradle / Ivy

There is a newer version: 0.23.0
Show newest version
package dev.inmo.micro_utils.fsm.common

import kotlinx.coroutines.flow.Flow

interface StatesManager {
    val onChainStateUpdated: Flow>
    val onStartChain: Flow
    val onEndChain: Flow


    /**
     * Must set current set using [State.context]
     */
    suspend fun update(old: T, new: T)

    /**
     * Starts chain with [state] as first [State]. May returns false in case of [State.context] of [state] is already
     * busy by the other [State]
     */
    suspend fun startChain(state: T)

    /**
     * Ends chain with context from [state]. In case when [State.context] of [state] is absent, [state] should be just
     * ignored
     */
    suspend fun endChain(state: T)

    suspend fun getActiveStates(): List
}





© 2015 - 2025 Weber Informatics LLC | Privacy Policy