You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
769 B
Kotlin
24 lines
769 B
Kotlin
4 years ago
|
package me.eater.hefbrug.platform_utils.service
|
||
|
|
||
|
import me.eater.hefbrug.executor.ExecutionContext
|
||
|
import me.eater.hefbrug.platform_utils.PlatformUtil
|
||
|
|
||
|
abstract class ServiceManager(protected val context: ExecutionContext) {
|
||
|
protected val ro = context.roAccess
|
||
|
protected val rw = context.rwAccess
|
||
|
|
||
|
abstract suspend fun isRunning(name: String): Boolean
|
||
|
abstract suspend fun isEnabled(name: String): Boolean
|
||
|
abstract suspend fun hasAutoStart(name: String): Boolean
|
||
|
abstract suspend fun setState(
|
||
|
name: String,
|
||
|
enabled: Boolean,
|
||
|
running: Boolean,
|
||
|
autostart: Boolean = enabled && running
|
||
|
)
|
||
|
|
||
|
companion object : PlatformUtil.Provider<ServiceManager>(
|
||
|
"service manager",
|
||
|
RunitManager.Util
|
||
|
)
|
||
|
}
|