PartitionDetector

Detects when a peer has become unresponsive and emits PartitionEvents for the layer above to act on.

Implementations are per-link: one PartitionDetector monitors one peer across one us.tractat.kuilt.core.Seam. The leader composes multiple detectors (one per connected peer) — that composition is the leader's concern, not this interface's.

Calling contract for observedPeer: The runtime must call observedPeer for every frame that arrives from the monitored peer, including application frames. This resets the liveness timeout in the same way a pong frame does — heartbeat is a dead-man's switch, not a dedicated keepalive channel.

Backpressure hook (onBackpressure): The leader must call onBackpressure when the per-peer outbound buffer exceeds the configured ceiling. The detector reacts by emitting PartitionEvent.PeerUnresponsive with PartitionEvent.Reason.Backpressure.

Inheritors

Properties

Link copied to clipboard
abstract val events: Flow<PartitionEvent>

Stream of reachability events for the monitored peer.

Functions

Link copied to clipboard
abstract fun observedPeer(peerId: PeerId)

Record that a frame arrived from the monitored peer.

Link copied to clipboard
abstract fun onBackpressure(peerId: PeerId)

Signal that the per-peer outbound buffer has exceeded its ceiling.

Link copied to clipboard
abstract fun start(scope: CoroutineScope)

Start the heartbeat loop, scoped to scope.

Link copied to clipboard
abstract suspend fun stop()

Stop the heartbeat loop and complete the events flow.