Skip to main content

Event

Enum Event 

Source
#[non_exhaustive]
pub enum Event { Input { id: DataId, meta: Metadata, data: Payload, }, InputClosed { id: DataId, source: PortRef, reason: RouteCloseReason, }, InputRecovered { id: DataId, source: PortRef, generation: u64, }, Stop(StopCause), Reload { operator: Option<OperatorId>, path: Option<String>, }, AllInputsClosed, ParamUpdate { scope: ParamScope, key: ParamKey, value: Parameter, }, ParamDeleted { scope: ParamScope, key: ParamKey, }, NodeFailed { peer: NodeId, cause: NodeExitCause, }, Restarted { peer: NodeId, generation: u64, }, ExtDropped { key: ExtensionKey, reason: String, }, Error(String), }
Expand description

One thing that happened to this node.

Event::Input carries exactly the three fields blueprint §9.1 destructures — { id, data, meta } — so the example there compiles verbatim. The producer port behind an input is a property of the node’s wiring rather than of the message, and is available from crate::Node::input_source.

Variants (Non-exhaustive)§

This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

Input

A message arrived on one of the node’s inputs.

Fields

§id: DataId

The input it arrived on.

§meta: Metadata

The metadata beside it, with AstRS-internal keys already stripped (§6.1).

§data: Payload

The payload — decoded lazily, and zero-copy when the route was upgraded (§6.3).

§

InputClosed

An input will receive nothing further.

Fields

§id: DataId

The input that closed.

§source: PortRef

The producer port that stopped.

§reason: RouteCloseReason

Why it closed.

§

InputRecovered

A closed input is live again, because its producer restarted (§12).

Fields

§id: DataId

The input that recovered.

§source: PortRef

The producer port that came back.

§generation: u64

The producer’s new incarnation.

§

Stop(StopCause)

Finish up and exit. The stream fuses after this.

§

Reload

Reload the node’s code, or one operator inside it (§9.3).

Fields

§operator: Option<OperatorId>

The operator to reload, or None for the whole node.

§path: Option<String>

The artefact to load, when it moved.

§

AllInputsClosed

Every input of this node has closed.

§

ParamUpdate

A parameter this node reads was written (§17 param set).

Fields

§scope: ParamScope

The scope it was written in.

§key: ParamKey

The key.

§value: Parameter

The new value.

§

ParamDeleted

A parameter this node reads was deleted.

Fields

§scope: ParamScope

The scope it was deleted from.

§key: ParamKey

The key.

§

NodeFailed

A peer node failed (§12).

Fields

§peer: NodeId

The node that failed.

§cause: NodeExitCause

How it failed.

§

Restarted

A peer node was restarted under its restart policy (§12).

Fields

§peer: NodeId

The node that came back.

§generation: u64

Its new incarnation.

§

ExtDropped

An extension entry this node owned was dropped.

Fields

§key: ExtensionKey

The key that went away.

§reason: String

Why.

§

Error(String)

The session hit a condition the node should know about but that does not end it — a queue overflow, an undecodable frame, a route the node could not map.

Implementations§

Source§

impl Event

Source

pub const fn input(&self) -> Option<&DataId>

The input this event concerns, when it concerns one.

Source

pub const fn is_input(&self) -> bool

Whether this event delivers data.

Source

pub const fn is_stop(&self) -> bool

Whether this event fuses the stream.

Source

pub const fn is_control(&self) -> bool

Whether this event travels on the control lane (§11.3).

Source

pub fn is_fault(&self) -> bool

Whether this event reports a fault rather than normal progress.

Source

pub const fn metadata(&self) -> Option<&Metadata>

The metadata this event carries, when it carries any.

Source

pub const fn payload(&self) -> Option<&Payload>

The payload this event carries, when it carries one.

Source

pub fn into_input(self) -> Option<(DataId, Metadata, Payload)>

Consumes the event and returns its payload and metadata, if it is an input.

Source

pub const fn kind_name(&self) -> &'static str

A short, stable slug for metrics labels and structured logs.

Trait Implementations§

Source§

impl Debug for Event

Source§

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

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

impl Display for Event

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl !Freeze for Event

§

impl !RefUnwindSafe for Event

§

impl !UnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

Blanket Implementations§

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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
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