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: IdFieldLogical process key shared by all versions of this workflow.
name: StringHuman-readable process name.
version: VersionIdNormalized process definition version.
status: ProcessStatusOnly 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: ProcessMetadataOptional 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
impl ProcessDefinition
Sourcepub fn compile(&self) -> Result<JsonValue, CreateProcessError>
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.
Sourcepub fn validate(&self) -> Result<(), CreateProcessError>
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.
Sourcepub fn unreachable_nodes(&self) -> Vec<IdField>
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
impl Clone for ProcessDefinition
Source§impl Debug for ProcessDefinition
impl Debug for ProcessDefinition
Source§impl<'de> Deserialize<'de> for ProcessDefinition
impl<'de> Deserialize<'de> for ProcessDefinition
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for ProcessDefinition
impl Serialize for ProcessDefinition
Source§impl TryInto<ProcessDefinition> for ProcessDefDb
impl TryInto<ProcessDefinition> for ProcessDefDb
Source§type Error = CreateProcessError
type Error = CreateProcessError
Auto Trait Implementations§
impl Forget for ProcessDefinition
impl Freeze for ProcessDefinition
impl Move for ProcessDefinition
impl RefUnwindSafe for ProcessDefinition
impl Send for ProcessDefinition
impl Sync for ProcessDefinition
impl Unpin for ProcessDefinition
impl UnsafeUnpin for ProcessDefinition
impl UnwindSafe for ProcessDefinition
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> FromFormData for Twhere
T: DeserializeOwned,
impl<T> FromFormData for Twhere
T: DeserializeOwned,
Source§fn from_event(ev: &Event) -> Result<T, FromFormDataError>
fn from_event(ev: &Event) -> Result<T, FromFormDataError>
submit event.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more