Skip to main content

Module source

Module source 

Source
Expand description

EventSource — the shared state between the session’s reader task and the node’s EventStream.

One Arc<EventSource> sits between them. The reader pushes; the stream pops; neither knows about the other. That separation is what lets the testing harness feed a stream without a socket, and what lets a node drop its stream (which the session notices and reports to the daemon as astrs_wire::NodeRequest::EventStreamDropped, §7.3) without racing the reader.

§Priority and fairness

EventSource::try_next drains the control deque first and only then asks the EventMux for data — blueprint §11.3’s “control lane pre-empts data lane”, applied at the one point where both lanes meet. Within the data lane the mux’s own round robin keeps a hot input from starving a quiet one.

§Counters

Every drop is counted, and every drop signal from the queue is turned into an Event::Error on the control lane, because blueprint §11.2 says a backpressure exhaustion is an ERROR-log-and-metric event rather than a silent loss. It is also written to the process log as a tracing::error! — the control-lane Event::Error only reaches a node that is reading its own event stream, while the process log reaches whatever is watching astrs/logs/* or stderr — throttled to once per input per DROP_LOG_WINDOW rather than once per dropped message: see EventSource::log_drop_signal, this module’s own (private) rate limiter.

§Deadlines (§11.3)

An input whose InputSpec::deadline is set gets an astrs_scheduler::DeadlineMonitor entry alongside its queue registration. Every data event EventSource::try_next hands to the node opens a measurement for that input, superseding (not queuing behind) any measurement already open for the same input — the newest arrival is what a node’s next publish is judged against, the same “the newest state is what matters” reasoning QueuePolicy::DropOldest applies to the queue itself, and what keeps the open set bounded by the node’s own input count rather than by how long it has been running. EventSource::finish_deadlines is the other half: called once per publish (see crate::session::SessionShared::send_request), it closes every open measurement against now and turns a astrs_scheduler::DeadlineOutcome::Violated into an Event::Error on the control lane — describe_signal’s §11.2 pattern, mirrored for §11.3.

Structs§

EventSource
The shared inbox behind an EventStream.
StreamStats
Counters a node (and astrs list) can read off a live stream.

Type Aliases§

AbandonHook
What runs when a node drops its event stream.
DeadlineViolationHook
What runs when EventSource::finish_deadlines finds a violation (§11.3): the input it was on, the budget, and the measured latency — everything astrs_wire::NodeRequest::ReportDeadlineViolation needs.