pub struct EventSource { /* private fields */ }Expand description
The shared inbox behind an EventStream.
Implementations§
Source§impl EventSource
impl EventSource
Sourcepub fn set_abandon_hook(&self, hook: AbandonHook)
pub fn set_abandon_hook(&self, hook: AbandonHook)
Installs the hook that runs when the node drops its stream.
Replaces any previous one; the session sets exactly one.
Sourcepub fn set_deadline_violation_hook(&self, hook: DeadlineViolationHook)
pub fn set_deadline_violation_hook(&self, hook: DeadlineViolationHook)
Installs the hook that runs once per deadline violation
EventSource::finish_deadlines finds (§11.3).
Replaces any previous one; the session sets exactly one — see
DeadlineViolationHook.
Sourcepub fn register_input(&self, spec: &InputSpec) -> Result<()>
pub fn register_input(&self, spec: &InputSpec) -> Result<()>
Registers an input with the queue size, policy and lane its manifest declares (§11.2, §11.3).
Also registers spec’s input-to-output latency budget, when it
declares one (InputSpec::deadline) — a no-op, harmlessly, for the
common case of an input with none.
§Errors
crate::NodeError::Scheduler when the input is already registered or the
declared capacity is zero.
Sourcepub fn register_raw(
&self,
id: DataId,
capacity: u32,
policy: QueuePolicy,
lane: PriorityLane,
) -> Result<()>
pub fn register_raw( &self, id: DataId, capacity: u32, policy: QueuePolicy, lane: PriorityLane, ) -> Result<()>
Registers an input explicitly, for a dynamic node with no manifest specification to read from.
§Errors
Sourcepub fn queue_snapshot(&self, id: &DataId) -> Option<QueueSnapshot>
pub fn queue_snapshot(&self, id: &DataId) -> Option<QueueSnapshot>
A point-in-time reading of one input’s queue.
Sourcepub fn push_input(&self, id: &DataId, event: QueuedEvent)
pub fn push_input(&self, id: &DataId, event: QueuedEvent)
Pushes a data-lane event onto id’s queue, applying its policy.
An unregistered input is reported on the control lane rather than silently dropped: it means the daemon and the node disagree about the wiring, which an operator needs to see.
Sourcepub fn push_control(&self, event: Event)
pub fn push_control(&self, event: Event)
Pushes a control-lane event, which is delivered before any data.
Sourcepub fn close(&self)
pub fn close(&self)
Marks the source finished: no further events will arrive, and waiting consumers wake immediately.
Idempotent.
Sourcepub fn abandon(&self)
pub fn abandon(&self)
Records that the node dropped its event stream (§7.3).
Idempotent: the hook runs once, however many times a stream is abandoned.
Sourcepub fn is_abandoned(&self) -> bool
pub fn is_abandoned(&self) -> bool
Whether the node dropped its event stream.
Sourcepub fn try_next(&self) -> Option<Event>
pub fn try_next(&self) -> Option<Event>
Takes the next event, control lane first, without waiting.
Sourcepub fn finish_deadlines(&self, now: Instant)
pub fn finish_deadlines(&self, now: Instant)
Closes every open input-to-output measurement against now (§11.3),
counting and reporting each one that ran over budget.
Called once per publish — see crate::session::SessionShared::send_request
— so the deadline check runs at the same cadence the daemon’s own
sends_inline/sends_zero_copy counters do. A node with nothing open
(no deadline-tracked input has delivered since the last publish, or
none is configured at all) does nothing here.
Sourcepub fn stats(&self) -> StreamStats
pub fn stats(&self) -> StreamStats
A snapshot of the stream’s counters.