JoinerReconnectController

Manages per-peer reconnect windows on the leader side.

When a joiner's transport link drops, the leader calls onPeerUnresponsive to open a timed reconnect window (default 60 s). Within that window the joiner can present a ResumeToken via tryResume to reattach. Once the window expires the peer is evicted and a late reconnect is treated as a fresh join.

State-resync (replaying application state to the reconnected joiner) is out of scope here. The consumer's leader logic subscribes to events and drives the state snapshot on JoinerReconnectEvent.Resumed. Integration point: observe events.filterIsInstance<JoinerReconnectEvent.Resumed>() and push current application state to event.peerId.

The leader identity is not part of ResumeToken; only RoomId is. This preserves forward-compatibility: if a future auto-election protocol promotes a new leader mid-session, RoomId survives the transition and joiners can resume against the new host without token renegotiation.

Partition events (PartitionEvent) are produced by the partition-detector layer. Until that wiring lands, callers bridge manually: on transport close, invoke onPeerUnresponsive directly.

Thread safety: implementations must be safe for concurrent calls.

Inheritors

Properties

Link copied to clipboard

Functions

Link copied to clipboard
abstract fun expire(peerId: PeerId, at: Long)

Force-expires the reconnect window for peerId before the timer fires.

Link copied to clipboard
abstract fun onPeerUnresponsive(peerId: PeerId, at: Long)

Opens (or refreshes) the reconnect window for peerId.

Link copied to clipboard
abstract suspend fun tryResume(token: ResumeToken, at: Long): ResumeResult

Attempts to resume the peer identified by token.