Skip to main content

Module server

Module server 

Source
Expand description

Daemon-side state, worker loop, and connection task. Decoupled from socket I/O so the queue and dispatch logic can be unit-tested with plain method calls.

Structs§

BroadcastSink
Daemon-side JobSink that translates every call into an Event and broadcasts it. Cheap to construct per job.
DaemonState
JobNotFound
QueuedJob
One unit of work waiting to run. The request carries the parameters; priority is also reflected here so the queue can rebalance on TogglePriority without re-reading the Request.
ReplayBuffer
Per-job ring of Events used to replay history when daemon attach targets a finished or in-flight job. Bounded both in jobs tracked (oldest job dropped when full) and in events per job (oldest event per job dropped when full).
RingBuffer
RunningJob

Functions§

handle_connection
Handle a single client connection. Reads exactly one Request, then either replies with a single Response and closes (control RPCs), or streams Events filtered by job id (job submissions, Subscribe, Attach) until terminated by JobFinished or a shutdown signal.
spawn_replay_collector
Spawn the replay collector. The broadcast subscription is created synchronously before the task is spawned, so events emitted between the call to this function and the spawned task’s first poll are not lost.
worker_loop
Single-job worker loop. Holds the SteamClient lazily: it is acquired on the first job that needs it and recreated after a connection-loss error so subsequent jobs reauthenticate transparently. preferred_user is forwarded into the lazy login flow.