pub trait Flow:
Send
+ Sync
+ 'static {
type StartInput: Value;
// Provided methods
fn flow_type(&self) -> &'static str { ... }
fn steps(&self) -> StepList<'_, Self::StartInput> { ... }
fn persistence(&self) -> PersistenceSchema { ... }
fn timeout_handler(&self) -> Option<FlowTimeoutHandler<Self>>
where Self: Sized { ... }
fn rpcs(&self) -> RpcList<Self>
where Self: Sized { ... }
}Expand description
Defines a durable application Flow and its registered API surface.
A Flow owns a typed start input, Step list, persistence schema, and RPC list. Implementations are
registered as owned values in crate::Registry and shared safely across Worker invocations.
Keep Self::flow_type and all subordinate names stable while any execution is running.
§Examples
use dex_sdk::{Flow, StepList};
struct OrderFlow;
impl Flow for OrderFlow {
type StartInput = String;
fn steps(&self) -> StepList<'_, Self::StartInput> {
StepList::empty()
}
}Required Associated Types§
Sourcetype StartInput: Value
type StartInput: Value
Value accepted by crate::Client::start_flow and the starting Step.
Provided Methods§
Sourcefn flow_type(&self) -> &'static str
fn flow_type(&self) -> &'static str
Returns the stable Flow type sent to Dex.
The default is the final Rust type-name segment.
Sourcefn steps(&self) -> StepList<'_, Self::StartInput>
fn steps(&self) -> StepList<'_, Self::StartInput>
Returns the starting Step and all other Step definitions.
The default is an empty list, which is valid only for Flows driven entirely by RPCs.
Sourcefn persistence(&self) -> PersistenceSchema
fn persistence(&self) -> PersistenceSchema
Declares every Attribute and Channel used by this Flow.
The default schema is empty.
Sourcefn timeout_handler(&self) -> Option<FlowTimeoutHandler<Self>>where
Self: Sized,
fn timeout_handler(&self) -> Option<FlowTimeoutHandler<Self>>where
Self: Sized,
Returns the optional handler invoked after this Flow’s durable timeout timer expires.
Returning Some makes a positive timeout default to crate::FlowTimeoutPolicy::Handler.
One logical execution may retry, and its decision uses normal Step Execute validation.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".