Mosaic

interface Mosaic(source)

Per-request context used to execute tiles and access dependencies.

Properties

Link copied to clipboard
abstract val canvas: Canvas

Functions

Link copied to clipboard
open suspend fun <V> compose(tile: Tile<V>): V

Await the value of a Tile

open suspend fun <K : Any, V> compose(tile: MultiTile<K, V>, key: K): V

Await a single value from a MultiTile

open suspend fun <K : Any, V> compose(tile: MultiTile<K, V>, keys: Collection<K>): Map<K, V>

Awaits all requested values of a MultiTile. Throws if any requested key fails; this strict operation does not return a partial map. Successful sibling outcomes remain cached. Use composeAsync to handle each key's outcome separately.

Link copied to clipboard
abstract fun <V> composeAsync(tile: Tile<V>): Deferred<V>

Returns Mosaic-owned shared work for tile. Callers may await it freely. To stop waiting, cancel your own coroutine or wait operation rather than cancelling the shared Deferred, which would affect other consumers.

open fun <K : Any, V> composeAsync(tile: MultiTile<K, V>, key: K): Deferred<V>

Returns Mosaic-owned shared work for key. Callers may await it freely. To stop waiting, cancel your own coroutine or wait operation rather than the shared Deferred, which would affect other consumers.

abstract fun <K : Any, V> composeAsync(tile: MultiTile<K, V>, keys: Collection<K>): Map<K, Deferred<V>>

Returns Mosaic-owned shared work for each equal key on tile within this Mosaic. Each key retains one terminal success or failure, including successful nullable values. An omitted provider map entry fails that key; provider failure affects unfinished keys in that physical invocation. Per-key and chunk factories isolate their invocation failures. Successful sibling keys remain cached. Exact physical batch boundaries are not guaranteed. Callers may await results freely. To stop waiting, cancel your own coroutine or wait operation rather than cancelling a shared Deferred, which would affect other consumers.

Inherited functions

Link copied to clipboard
inline fun <T : Any> Mosaic.source(qualifier: String? = null): T

Retrieves a dependency from the canvas using reified type parameters.

fun <T : Any> Mosaic.source(key: CanvasKey<T>): T

Retrieves a dependency from the canvas using a CanvasKey.

Link copied to clipboard
inline fun <T : Any> Mosaic.sourceOrNull(qualifier: String? = null): T?

Retrieves a dependency from the canvas using reified type parameters, returning null if not found.

fun <T : Any> Mosaic.sourceOrNull(key: CanvasKey<T>): T?

Retrieves a dependency from the canvas using a CanvasKey, returning null if not found.