HeartbeatPartitionDetector
class HeartbeatPartitionDetector(link: Seam, peerId: PeerId, config: HeartbeatConfig = HeartbeatConfig(), clock: () -> Instant) : PartitionDetector
Application-level heartbeat-based implementation of PartitionDetector.
Runs a ping loop on link, emitting PartitionEvents as the peer transitions through the Healthy → Unresponsive → Lost state machine.
State machine (per peer):
Healthy ──(no frame for config.timeout)──────────────► Unresponsive
Healthy ──(onBackpressure called)────────────────────► Unresponsive(Backpressure)
Healthy ──(link closes)──────────────────────────────► Unresponsive(TransportClosed)
Unresponsive ──(frame observed)──────────────────────► Healthy (PeerRecovered emitted)
Unresponsive ──(reconnectWindow elapsed)─────────────► Lost (PeerLost emitted; stops)Content copied to clipboard
Heartbeat frame format: Ping frames carry the prefix kuilt.heartbeat.ping; pong frames carry kuilt.heartbeat.pong. Both are consumed internally and never forwarded to the application's Seam.incoming subscription. Applications must not emit frames with these prefixes.
Clock injection: clock is never kotlin.time.Clock.System — it is injected by the caller so tests can use a fixed value and runTest virtual time controls all delays.
Parameters
Constructors
Link copied to clipboard
constructor(link: Seam, peerId: PeerId, config: HeartbeatConfig = HeartbeatConfig(), clock: () -> Instant)