Skip to main content

Module keepalive

Module keepalive 

Source
Expand description

Message-based link implementation.

The link has two actors. KeepaliveWorker runs on the worker side and owns the outbound keepalive stream. KeepaliveSupervisor runs on the supervisor side and acknowledges each keepalive. The worker sends Keepalive with a reply port for the worker’s KeepaliveAck handler. The supervisor answers with KeepaliveAck on that reply port. Either side may fail the link: the worker fails if a keepalive is not acknowledged within timeout, and the supervisor fails if no newer keepalive is delivered within timeout.

Keepalives carry monotonically increasing generation numbers. A generation identifies one worker-issued keepalive and the local timers derived from it. We use generations instead of canceling timers: if a later generation has already been observed, a delayed timer for an older generation is stale and is ignored. This relies on Hyperactor’s in-order delivery guarantee for messages sent along a single actor-to-actor path. In particular, the supervisor observes keepalives from one worker in generation order, and each actor observes its own scheduled control messages in the order in which they become deliverable. The generation checks make late timers harmless, while ordered delivery preserves the meaning of “no newer generation arrived before this deadline.”

The worker uses two internal self messages. [SendKeepalive] advances the stream after interval if its generation is still current. [AckDeadline] checks after timeout whether the corresponding generation was acknowledged. The supervisor uses [Deadline] to check whether a newer generation arrived before its timeout.

Structs§

Keepalive
Keepalive request sent to a KeepaliveSupervisor.
KeepaliveAck
Acknowledgment for an accepted keepalive.
KeepaliveLink
Keepalive link configuration.
KeepaliveParams
Keepalive timing parameters.
KeepaliveSupervisor
Supervisor-side keepalive link actor.
KeepaliveSupervisorParams
Parameters for KeepaliveSupervisor.
KeepaliveWorker
Worker-side keepalive link actor.
KeepaliveWorkerParams
Parameters for KeepaliveWorker.

Traits§

KeepaliveClient
The custom client trait for this message type.
KeepaliveHandler
The custom handler trait for this message type.