CompositeLoom

constructor(plies: StateFlow<List<Pair<PlyId, Loom>>>, dispatcher: CoroutineContext = Dispatchers.Default, policy: DeliveryPolicy = DeliveryPolicy.Reliable, onPlyFailure: (PlyReconcileException) -> Unit = {})

Parameters

plies

The desired ply set; emit a new value to reconcile (attach/detach).

dispatcher

Forwarded to each CompositeSeam as the scope for its internal coroutines (scheduling only — the woven seam's thread-safety is via a lock + atomics, so it is correct under a multi-threaded dispatcher). Production default (Dispatchers.Default); tests inject a dispatcher derived from the test scheduler.

policy

Governs the inbound us.tractat.kuilt.core.Spool's capacity and overflow behaviour for each woven CompositeSeam. Defaults to DeliveryPolicy.Reliable (bounded, backpressured, lossless).

onPlyFailure

Raised whenever one ply fails inside a live session — a constituent Loom's capability()/weave() or a ply Seam's close() threw while reconciling, or a peer sent an inbound frame the ply could not process. The composite absorbs the failure and keeps going: the other plies still reconcile, a failed attach is retried on the next plies emission, and a ply whose inbound frame failed drops that frame and keeps delivering. kuilt-core is logger-free, so this is how that surfaces to a consumer's own logger. Best-effort and non-suspending; defaults to a silent absorb. See PlyReconcileException.


constructor(plies: List<Pair<PlyId, Loom>>, dispatcher: CoroutineContext = Dispatchers.Default, policy: DeliveryPolicy = DeliveryPolicy.Reliable, onPlyFailure: (PlyReconcileException) -> Unit = {})

Static convenience: a fixed ply set that never changes after weave().