Skip to main content

ProcessDefinition

Struct ProcessDefinition 

Source
pub struct ProcessDefinition {
Show 14 fields pub uuid: Option<Uuid>, pub key: IdField, pub name: String, pub version: VersionId, pub status: ProcessStatus, pub effective_from: Option<DateTime<Utc>>, pub deprecated_at: Option<DateTime<Utc>>, pub metadata: ProcessMetadata, pub signals: Vec<SignalDef>, pub forms: Vec<FormDef>, pub stages: Vec<StageDef>, pub special_handlers: Option<SpecialHandlers>, pub escalations: Vec<EscalationDef>, pub nodes: Vec<Node>,
}
Expand description

A versioned workflow definition with declarations and executable nodes.

§Examples

use fluxpro_engine::models::process_def::ProcessDefinition;

let definition: ProcessDefinition = serde_json::from_value(serde_json::json!({
    "key": "demo", "name": "Demo", "version": "1.0.0", "status": "active",
    "effective_from": "2026-01-01T00:00:00Z",
    "stages": [{ "id": "created", "name": "Created", "is_initial": true }],
    "nodes": [
        { "id": "start", "type": "Start", "next": "done" },
        { "id": "done", "type": "End" }
    ]
})).unwrap();
assert!(definition.validate().is_ok());
assert_eq!(definition.compile().unwrap()["nodes"][0]["type"], "Start");

Fields§

§uuid: Option<Uuid>

Database identity; skipped in JSON/YAML and assigned after persistence.

§key: IdField

Logical process key shared by all versions of this workflow.

§name: String

Human-readable process name.

§version: VersionId

Normalized process definition version.

§status: ProcessStatus

Only active definitions within their effective dates may start new instances.

§effective_from: Option<DateTime<Utc>>

UTC time from which this definition can be selected.

§deprecated_at: Option<DateTime<Utc>>

UTC time after which this definition is excluded from runtime selection.

§metadata: ProcessMetadata

Optional ownership, SLA, and version notes.

§signals: Vec<SignalDef>

Signal declarations available to the workflow.

§forms: Vec<FormDef>

Forms declared for user-task lifecycle hooks.

§stages: Vec<StageDef>

Business stages; runtime startup requires an initial stage.

§special_handlers: Option<SpecialHandlers>

Optional callbacks invoked during stage, form, and completion events.

§escalations: Vec<EscalationDef>

Operator escalation topics and available actions.

§nodes: Vec<Node>

Workflow graph; exactly one Start and at least one End are required.

Implementations§

Source§

impl ProcessDefinition

Source

pub fn compile(&self) -> Result<JsonValue, CreateProcessError>

Validates references and serializes this definition to JSON.

§Errors

Returns structural failures and, with runtime, condition compilation errors.

Source

pub fn validate(&self) -> Result<(), CreateProcessError>

Checks unique IDs, start/end presence, references, and service retry settings.

§Errors

Returns accumulated validation messages, including initial stages and timers. With runtime, also compiles conditions. Handler registration is host-owned. Use unreachable_nodes for reachability diagnostics.

Source

pub fn unreachable_nodes(&self) -> Vec<IdField>

Lists nodes with no structural path from Start, in definition order.

This is diagnostic rather than a registration error because hosts may explicitly enqueue auxiliary nodes. Conditions are not evaluated.

Trait Implementations§

Source§

impl Clone for ProcessDefinition

Source§

fn clone(&self) -> ProcessDefinition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ProcessDefinition

Source§

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

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

impl<'de> Deserialize<'de> for ProcessDefinition

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 ProcessDefinition

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§

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> 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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

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