FaultySeam

class FaultySeam(delegate: Seam, scope: CoroutineScope, initialProfile: FaultProfile = FaultProfile.Healthy, policy: DeliveryPolicy = DeliveryPolicy.Reliable) : Seam

A Seam wrapper that injects configurable faults for use in tests.

Faults are driven by a FaultProfile which can be swapped atomically at any point during a test via setFaultProfile. The profile change takes effect on the next frame — frames already in-flight at the moment of the switch complete under the old profile.

Determinism guarantee: every probabilistic and randomised fault takes an explicit seed. No wall-clock time is consumed — delays go through kotlinx.coroutines.delay so kotlinx.coroutines.test.runTest controls virtual time.

Inspection hooks: framesDropped, framesDelayed, and framesDelivered counters are updated atomically so tests can assert on fault behaviour without inspecting internal channels.

Consumed by partition / reconnect test suites. Exposes the same Seam contract as InMemoryLoom-produced links.

Constructors

Link copied to clipboard
constructor(delegate: Seam, scope: CoroutineScope, initialProfile: FaultProfile = FaultProfile.Healthy, policy: DeliveryPolicy = DeliveryPolicy.Reliable)

Properties

Link copied to clipboard
open val capability: StateFlow<TransportCapability>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override val incoming: Flow<Swatch>
Link copied to clipboard
open val maxPayloadBytes: Int?
Link copied to clipboard
open override val peers: StateFlow<Set<PeerId>>
Link copied to clipboard
open val plies: StateFlow<Map<PlyId, SeamState>>
Link copied to clipboard
open override val selfId: PeerId
Link copied to clipboard
open override val state: StateFlow<SeamState>

Functions

Link copied to clipboard
open suspend override fun broadcast(payload: ByteArray)
Link copied to clipboard
open suspend override fun close(reason: CloseReason)
Link copied to clipboard
fun heal()
Link copied to clipboard
fun partition(direction: Direction = Direction.Both)
Link copied to clipboard
open suspend override fun sendTo(peer: PeerId, payload: ByteArray)
Link copied to clipboard

Replace the active FaultProfile atomically.