Yokan / rebuild
Course 1 8624561

PlatformRecipeServices.kt

composeApp/src/commonMain/kotlin/eu/friedcutlet/yokan/services/extensions/recipe/PlatformRecipeServices.kt

implementation28 lines
1package eu.friedcutlet.yokan.services.extensions.recipe23import eu.friedcutlet.yokan.database.YokanDatabase4/** Platform-owned signed-recipe capabilities; a null runtime binding disables recipe execution. */5class PlatformRecipeServices(6    val installation: RecipeCatalogInstallationService,7    val runtimeBindings: RecipeRuntimeBindings?,8)910expect fun createPlatformRecipeServices(11    database: YokanDatabase,12    clock: RecipeInstallationClock,13): PlatformRecipeServices1415/** Platforms without the isolated JVM transport reject all signed-recipe operations. */16internal fun unavailablePlatformRecipeServices(clock: RecipeInstallationClock): PlatformRecipeServices =17    PlatformRecipeServices(18        installation = RecipeCatalogInstallationService(ClosedRecipeInstallationStore, RecipeCatalogDownloader { _, _, _ -> throw RecipeTransportUnavailableException() }, clock),19        runtimeBindings = null,20    )2122private object ClosedRecipeInstallationStore : RecipeInstallationStore {23    override suspend fun enrollIfAbsent(catalogId: String, trustPolicy: eu.friedcutlet.yokan.services.extensions.recipe.CatalogTrustPolicy) = RecipeCatalogEnrollmentResult.Rejected24    override suspend fun readCatalog(catalogId: String) = null25    override suspend fun commitInstall(expectedGeneration: eu.friedcutlet.yokan.services.extensions.recipe.CatalogSnapshotGeneration, candidate: RecipeInstallCandidate) = RecipeInstallCommitResult.Rejected26}2728private class RecipeTransportUnavailableException : IllegalStateException()29

Search chapters, reference and source filenames.