Skip to main content

Event

Enum Event 

Source
pub enum Event {
    RunCreated {
        run_id: Uuid,
        workflow_name: String,
        at: DateTime<Utc>,
    },
    RunStatusChanged {
        run_id: Uuid,
        workflow_name: String,
        from: RunStatus,
        to: RunStatus,
        error: Option<String>,
        cost_usd: Decimal,
        duration_ms: u64,
        at: DateTime<Utc>,
    },
    StepCompleted {
        run_id: Uuid,
        step_id: Uuid,
        step_name: String,
        kind: StepKind,
        duration_ms: u64,
        cost_usd: Decimal,
        at: DateTime<Utc>,
    },
    StepFailed {
        run_id: Uuid,
        step_id: Uuid,
        step_name: String,
        kind: StepKind,
        error: String,
        at: DateTime<Utc>,
    },
    ApprovalRequested {
        run_id: Uuid,
        step_id: Uuid,
        message: String,
        at: DateTime<Utc>,
    },
    ApprovalGranted {
        run_id: Uuid,
        approved_by: String,
        at: DateTime<Utc>,
    },
    ApprovalRejected {
        run_id: Uuid,
        rejected_by: String,
        at: DateTime<Utc>,
    },
    UserSignedIn {
        user_id: Uuid,
        username: String,
        at: DateTime<Utc>,
    },
    UserSignedUp {
        user_id: Uuid,
        username: String,
        at: DateTime<Utc>,
    },
    UserSignedOut {
        user_id: Uuid,
        at: DateTime<Utc>,
    },
}
Expand description

A domain event emitted by the ironflow system.

Covers the full lifecycle: runs, steps, approvals, and authentication. Subscribers receive these via EventPublisher and pattern-match on the variants they care about.

§Examples

use ironflow_engine::notify::Event;
use ironflow_store::models::RunStatus;
use uuid::Uuid;

let event = Event::RunStatusChanged {
    run_id: Uuid::now_v7(),
    workflow_name: "deploy".to_string(),
    from: RunStatus::Running,
    to: RunStatus::Completed,
    error: None,
    cost_usd: rust_decimal::Decimal::ZERO,
    duration_ms: 5000,
    at: chrono::Utc::now(),
};

Variants§

§

RunCreated

A new run was created (status: Pending).

Fields

§run_id: Uuid

Run identifier.

§workflow_name: String

Workflow name.

§at: DateTime<Utc>

When the run was created.

§

RunStatusChanged

A run changed status.

Fields

§run_id: Uuid

Run identifier.

§workflow_name: String

Workflow name.

§from: RunStatus

Previous status.

§to: RunStatus

New status.

§error: Option<String>

Error message (when transitioning to Failed).

§cost_usd: Decimal

Aggregated cost in USD at the time of transition.

§duration_ms: u64

Aggregated duration in milliseconds at the time of transition.

§at: DateTime<Utc>

When the transition occurred.

§

StepCompleted

A step completed successfully.

Fields

§run_id: Uuid

Run identifier.

§step_id: Uuid

Step identifier.

§step_name: String

Human-readable step name.

§kind: StepKind

Step operation kind.

§duration_ms: u64

Step duration in milliseconds.

§cost_usd: Decimal

Step cost in USD.

§at: DateTime<Utc>

When the step completed.

§

StepFailed

A step failed.

Fields

§run_id: Uuid

Run identifier.

§step_id: Uuid

Step identifier.

§step_name: String

Human-readable step name.

§kind: StepKind

Step operation kind.

§error: String

Error message.

§at: DateTime<Utc>

When the step failed.

§

ApprovalRequested

A run is waiting for human approval.

Fields

§run_id: Uuid

Run identifier.

§step_id: Uuid

Approval step identifier.

§message: String

Message displayed to reviewers.

§at: DateTime<Utc>

When the approval was requested.

§

ApprovalGranted

A run was approved by a human.

Fields

§run_id: Uuid

Run identifier.

§approved_by: String

User who approved (ID or username).

§at: DateTime<Utc>

When the approval was granted.

§

ApprovalRejected

A run was rejected by a human.

Fields

§run_id: Uuid

Run identifier.

§rejected_by: String

User who rejected (ID or username).

§at: DateTime<Utc>

When the rejection occurred.

§

UserSignedIn

A user signed in.

Fields

§user_id: Uuid

User identifier.

§username: String

Username.

§at: DateTime<Utc>

When the sign-in occurred.

§

UserSignedUp

A new user signed up.

Fields

§user_id: Uuid

User identifier.

§username: String

Username.

§at: DateTime<Utc>

When the sign-up occurred.

§

UserSignedOut

A user signed out.

Fields

§user_id: Uuid

User identifier.

§at: DateTime<Utc>

When the sign-out occurred.

Implementations§

Source§

impl Event

Source

pub const RUN_CREATED: &'static str = "run_created"

Event type constant for RunCreated.

Source

pub const RUN_STATUS_CHANGED: &'static str = "run_status_changed"

Event type constant for RunStatusChanged.

Source

pub const STEP_COMPLETED: &'static str = "step_completed"

Event type constant for StepCompleted.

Source

pub const STEP_FAILED: &'static str = "step_failed"

Event type constant for StepFailed.

Source

pub const APPROVAL_REQUESTED: &'static str = "approval_requested"

Event type constant for ApprovalRequested.

Source

pub const APPROVAL_GRANTED: &'static str = "approval_granted"

Event type constant for ApprovalGranted.

Source

pub const APPROVAL_REJECTED: &'static str = "approval_rejected"

Event type constant for ApprovalRejected.

Source

pub const USER_SIGNED_IN: &'static str = "user_signed_in"

Event type constant for UserSignedIn.

Source

pub const USER_SIGNED_UP: &'static str = "user_signed_up"

Event type constant for UserSignedUp.

Source

pub const USER_SIGNED_OUT: &'static str = "user_signed_out"

Event type constant for UserSignedOut.

Source

pub const ALL: &'static [&'static str]

All event types. Pass this to EventPublisher::subscribe to receive every event.

§Examples
use ironflow_engine::notify::{Event, EventPublisher, WebhookSubscriber};

let mut publisher = EventPublisher::new();
publisher.subscribe(
    WebhookSubscriber::new("https://example.com/all"),
    Event::ALL,
);
Source

pub fn event_type(&self) -> &'static str

Returns the event type as a static string (e.g. "run_status_changed").

Useful for filtering and logging without deserializing.

§Examples
use ironflow_engine::notify::Event;
use uuid::Uuid;
use chrono::Utc;

let event = Event::UserSignedIn {
    user_id: Uuid::now_v7(),
    username: "alice".to_string(),
    at: Utc::now(),
};
assert_eq!(event.event_type(), "user_signed_in");

Trait Implementations§

Source§

impl Clone for Event

Source§

fn clone(&self) -> Event

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Event

Source§

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

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

impl<'de> Deserialize<'de> for Event

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for Event

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

§

impl Freeze for Event

§

impl RefUnwindSafe for Event

§

impl Send for Event

§

impl Sync for Event

§

impl Unpin for Event

§

impl UnsafeUnpin for Event

§

impl UnwindSafe 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DynClone for T
where T: Clone,

Source§

fn __clone_box(&self, _: Private) -> *mut ()

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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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<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
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,