pub struct WorkflowContext<'a> { /* private fields */ }Expand description
Replay helper for Rust workflow runtimes.
WorkflowContext is a read-only view over a workflow invocation. It provides
deterministic helpers for inspecting persisted history and returning the
next command to the engine.
Implementations§
Source§impl<'a> WorkflowContext<'a>
impl<'a> WorkflowContext<'a>
pub fn new(invocation: &'a WorkflowInvocation) -> Self
pub fn run_id(&self) -> &str
pub fn input(&self) -> &JsonValue
Sourcepub fn input_as<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn input_as<T>(&self) -> Result<T>where
T: DeserializeOwned,
Decode the workflow input into a host-defined serde type.
pub fn history(&self) -> &[FlowEventEnvelope]
pub fn step_output(&self, step_id: &str) -> Option<&JsonValue>
pub fn step_output_as<T>(&self, step_id: &str) -> Result<Option<T>>where
T: DeserializeOwned,
pub fn step_completed(&self, step_id: &str) -> bool
pub fn step_failed(&self, step_id: &str) -> Option<&str>
pub fn wait_completed(&self, wait_id: &str) -> bool
pub fn hook_payload(&self, hook_id: &str) -> Option<&JsonValue>
pub fn hook_payload_as<T>(&self, hook_id: &str) -> Result<Option<T>>where
T: DeserializeOwned,
pub fn hook_disposed(&self, hook_id: &str) -> bool
pub fn complete(&self, output: JsonValue) -> RuntimeCommand
pub fn fail(&self, error: impl Into<String>) -> RuntimeCommand
pub fn schedule_step( &self, step_id: impl Into<String>, step_name: impl Into<String>, input: JsonValue, ) -> RuntimeCommand
pub fn schedule_step_with_retry( &self, step_id: impl Into<String>, step_name: impl Into<String>, input: JsonValue, retry: RetryPolicy, ) -> RuntimeCommand
pub fn step( &self, step_id: impl Into<String>, step_name: impl Into<String>, input: JsonValue, ) -> StepCommand
pub fn step_with_retry( &self, step_id: impl Into<String>, step_name: impl Into<String>, input: JsonValue, retry: RetryPolicy, ) -> StepCommand
pub fn schedule_steps(&self, steps: Vec<StepCommand>) -> RuntimeCommand
pub fn wait_until( &self, wait_id: impl Into<String>, resume_at: DateTime<Utc>, ) -> RuntimeCommand
pub fn create_hook( &self, hook_id: impl Into<String>, token: impl Into<String>, metadata: JsonValue, ) -> RuntimeCommand
pub fn create_hook_with_metadata( &self, hook_id: impl Into<String>, token: impl Into<String>, metadata: HookMetadata, ) -> Result<RuntimeCommand>
Auto Trait Implementations§
impl<'a> Freeze for WorkflowContext<'a>
impl<'a> RefUnwindSafe for WorkflowContext<'a>
impl<'a> Send for WorkflowContext<'a>
impl<'a> Sync for WorkflowContext<'a>
impl<'a> Unpin for WorkflowContext<'a>
impl<'a> UnsafeUnpin for WorkflowContext<'a>
impl<'a> UnwindSafe for WorkflowContext<'a>
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
Mutably borrows from an owned value. Read more