pub struct RunState {Show 24 fields
pub break_before: Option<String>,
pub id: String,
pub workflow: String,
pub workflow_hash: String,
pub inputs: Value,
pub status: RunStatus,
pub start: Start,
pub steps: BTreeMap<String, StepState>,
pub vars: Map<String, Value>,
pub tokens: u64,
pub steps_run: u32,
pub output: Option<Value>,
pub error: Option<String>,
pub task: Option<String>,
pub principal: Option<String>,
pub conversation: Option<String>,
pub children: Vec<String>,
pub parent: Option<Value>,
pub attempt: u32,
pub created: u64,
pub updated: u64,
pub finished: Option<u64>,
pub deadline_ms: Option<u64>,
pub dirty: bool,
}Expand description
The durable run record (RFC 0025 §3.3 run, RFC 0027 §9).
Fields§
§break_before: Option<String>Stop this run just before the named step starts (a breakpoint set with
workflow.pause {before_step}). Durable, so it survives a restart —
which is the point: the interesting bugs are the ones that need one.
id: String§workflow: String§workflow_hash: String§inputs: Value§status: RunStatus§start: Start§steps: BTreeMap<String, StepState>§vars: Map<String, Value>§tokens: u64§steps_run: u32§output: Option<Value>§error: Option<String>§task: Option<String>§principal: Option<String>§conversation: Option<String>§children: Vec<String>§parent: Option<Value>§attempt: u32§created: u64§updated: u64§finished: Option<u64>§deadline_ms: Option<u64>§dirty: boolImplementations§
Source§impl RunState
impl RunState
pub fn new(id: &str, wf: &Workflow, start: Start, inputs: Value) -> RunState
pub fn touch(&mut self)
pub fn step(&self, id: &str) -> Option<&StepState>
Sourcepub fn data(&self, env: Value, memory: Value) -> Data
pub fn data(&self, env: Value, memory: Value) -> Data
The template data view of this run (RFC 0027 §3). memory and env
are supplied by the caller (env curated + secret-free).
Sourcepub fn begin_step(&mut self, id: &str) -> u32
pub fn begin_step(&mut self, id: &str) -> u32
Mark a step running (attempt +1). Returns the attempt.
Sourcepub fn end_step(
&mut self,
id: &str,
status: StepStatus,
output: Option<Value>,
error: Option<String>,
)
pub fn end_step( &mut self, id: &str, status: StepStatus, output: Option<Value>, error: Option<String>, )
Record a step’s terminal outcome.
Sourcepub fn suspend_step(&mut self, id: &str, wait: Value)
pub fn suspend_step(&mut self, id: &str, wait: Value)
Record a suspension (timer/gate/budget).
Sourcepub fn finish(
&mut self,
status: RunStatus,
output: Option<Value>,
error: Option<String>,
)
pub fn finish( &mut self, status: RunStatus, output: Option<Value>, error: Option<String>, )
Terminal transition of the run.
Sourcepub fn write_var(&mut self, key: &str, value: Value, mode: &str)
pub fn write_var(&mut self, key: &str, value: Value, mode: &str)
Apply an assign/transform write with a reducer mode.
pub fn summary(&self) -> Value
Trait Implementations§
Source§impl<'de> Deserialize<'de> for RunState
impl<'de> Deserialize<'de> for RunState
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>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for RunState
Auto Trait Implementations§
impl Freeze for RunState
impl RefUnwindSafe for RunState
impl Send for RunState
impl Sync for RunState
impl Unpin for RunState
impl UnsafeUnpin for RunState
impl UnwindSafe for RunState
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