Skip to main content

EventSource

Struct EventSource 

Source
pub struct EventSource { /* private fields */ }
Expand description

The shared inbox behind an EventStream.

Implementations§

Source§

impl EventSource

Source

pub fn new() -> Self

An empty source with no inputs registered.

Source

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.

Source

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.

Source

pub const fn signal(&self) -> &Signal

The wakeup both faces of the stream wait on.

Source

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.

Source

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

As EventSource::register_input.

Source

pub fn has_input(&self, id: &DataId) -> bool

Whether id is a registered input.

Source

pub fn input_ids(&self) -> Vec<DataId>

The registered input ids.

Source

pub fn queue_snapshot(&self, id: &DataId) -> Option<QueueSnapshot>

A point-in-time reading of one input’s queue.

Source

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.

Source

pub fn push_control(&self, event: Event)

Pushes a control-lane event, which is delivered before any data.

Source

pub fn close(&self)

Marks the source finished: no further events will arrive, and waiting consumers wake immediately.

Idempotent.

Source

pub fn is_closed(&self) -> bool

Whether the source has been closed.

Source

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.

Source

pub fn is_abandoned(&self) -> bool

Whether the node dropped its event stream.

Source

pub fn try_next(&self) -> Option<Event>

Takes the next event, control lane first, without waiting.

Source

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.

Source

pub fn is_empty(&self) -> bool

Whether anything is waiting to be delivered right now.

Source

pub fn stats(&self) -> StreamStats

A snapshot of the stream’s counters.

Trait Implementations§

Source§

impl Debug for EventSource

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for EventSource

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> MaybeDebug for T

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more