-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathMain.kt
29 lines (25 loc) · 913 Bytes
/
Main.kt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import io.sellmair.evas.Events
import io.sellmair.evas.States
import io.sellmair.evas.collectEventsAsync
import io.sellmair.evas.emit
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.cancelChildren
import kotlinx.coroutines.launch
import kotlinx.coroutines.runBlocking
import okio.Path.Companion.toPath
fun main(args: Array<String>): Unit = runBlocking(Events() + States() + SupervisorJob()) {
launchUiActor()
launchSummaryStateActor()
launchInitialPathsStateActor()
launchDiscoveryActors()
/* Send arguments, representing the entry points, as events */
launch {
args.forEach { arg ->
InitialPathEvent(arg.toPath()).emit()
}
}
/* Await the discovery of files to finish, cancel all children: Programm finished going over all files */
collectEventsAsync<DiscoveryFinishedEvent> {
coroutineContext.cancelChildren()
}
}