Add Comments

This commit is contained in:
2025-03-03 21:08:21 +01:00
parent ae5c229e4b
commit de3d4a1021
18 changed files with 111 additions and 12 deletions

View File

@@ -2,6 +2,11 @@ package eventDemo.libs.command
import kotlin.reflect.KClass
/**
* Represent a Command stream.
*
* The stream contains a list of all actions yet to be executed.
*/
interface CommandStream<C : Command> {
/**
* Send a new [Command] to the queue.
@@ -22,7 +27,7 @@ interface CommandStream<C : Command> {
}
/**
* A class to implement succes/faild action.
* A class to implement success/failed action.
*/
interface ComputeStatus {
fun ack()
@@ -30,7 +35,10 @@ interface CommandStream<C : Command> {
fun nack()
}
suspend fun process(block: CommandBlock<C>)
/**
* Apply an action to all command income in the stream.
*/
suspend fun process(action: CommandBlock<C>)
}
suspend inline fun <reified C : Command> CommandStream<C>.send(vararg command: C) = send(C::class, *command)