pub struct WorkflowContext {
pub branch_id: String,
pub config: Value,
pub instance_metadata: Value,
pub state: Arc<dyn State>,
pub recorder: Arc<dyn RunRecorder>,
pub trigger_kind: String,
}Expand description
The execution context handed to every step node.
Port of the subset of WorkflowContext a node legitimately touches:
branch id (for state scoping), instance config + metadata (for template
resolution), and the state handle. I/O tool calls (ctx.do(...)) are the
next porting phase.
Fields§
§branch_id: StringWorkflow branch this record belongs to.
config: ValueConfiguration object validated against the declared schema.
instance_metadata: ValueInstance metadata available to templates.
state: Arc<dyn State>Branch-scoped durable state handle.
recorder: Arc<dyn RunRecorder>Run recorder receiving step facts.
trigger_kind: StringKind of trigger that started the run.
Implementations§
Source§impl WorkflowContext
impl WorkflowContext
Sourcepub fn new(branch_id: impl Into<String>, state: Arc<dyn State>) -> Self
pub fn new(branch_id: impl Into<String>, state: Arc<dyn State>) -> Self
Context for branch_id over state with a no-op recorder.
Sourcepub fn with_config(self, config: Value) -> Self
pub fn with_config(self, config: Value) -> Self
Attach instance config.
Sourcepub fn with_recorder(self, recorder: Arc<dyn RunRecorder>) -> Self
pub fn with_recorder(self, recorder: Arc<dyn RunRecorder>) -> Self
Attach a recorder.
Sourcepub fn with_trigger_kind(self, trigger_kind: impl Into<String>) -> Self
pub fn with_trigger_kind(self, trigger_kind: impl Into<String>) -> Self
Set the trigger kind.
Auto Trait Implementations§
impl !RefUnwindSafe for WorkflowContext
impl !UnwindSafe for WorkflowContext
impl Freeze for WorkflowContext
impl Send for WorkflowContext
impl Sync for WorkflowContext
impl Unpin for WorkflowContext
impl UnsafeUnpin for WorkflowContext
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