pub struct WorkflowStore { /* private fields */ }Expand description
Manages workflow lifecycle and step tracking.
Implementations§
Source§impl WorkflowStore
impl WorkflowStore
Sourcepub fn create_workflow(
&self,
id: &str,
name: &str,
input: Option<Value>,
metadata: Option<Value>,
) -> Result<()>
pub fn create_workflow( &self, id: &str, name: &str, input: Option<Value>, metadata: Option<Value>, ) -> Result<()>
Create a new workflow in pending status.
Sourcepub fn add_step(
&self,
workflow_id: &str,
name: &str,
input: Option<Value>,
) -> Result<String>
pub fn add_step( &self, workflow_id: &str, name: &str, input: Option<Value>, ) -> Result<String>
Append a step to an existing workflow.
The step_index is assigned automatically as one more than the current
maximum index in the workflow (0-based). Returns the new step ID.
Sourcepub fn update_step(
&self,
step_id: &str,
status: &str,
output: Option<Value>,
error: Option<&str>,
) -> Result<()>
pub fn update_step( &self, step_id: &str, status: &str, output: Option<Value>, error: Option<&str>, ) -> Result<()>
Update the status, output, and/or error of a workflow step.
When status is "running" the started_at timestamp is recorded.
When status is "completed" or "failed" the completed_at
timestamp is recorded.
Sourcepub fn complete_workflow(&self, id: &str, output: Option<Value>) -> Result<()>
pub fn complete_workflow(&self, id: &str, output: Option<Value>) -> Result<()>
Mark a workflow as completed and record its output.
Sourcepub fn fail_workflow(&self, id: &str, error: Option<&str>) -> Result<()>
pub fn fail_workflow(&self, id: &str, error: Option<&str>) -> Result<()>
Mark a workflow as failed and record an optional error message.
Sourcepub fn get_workflow(&self, id: &str) -> Result<Workflow>
pub fn get_workflow(&self, id: &str) -> Result<Workflow>
Retrieve a workflow and all of its steps.
Sourcepub fn list_workflows(
&self,
status_filter: Option<&str>,
) -> Result<Vec<Workflow>>
pub fn list_workflows( &self, status_filter: Option<&str>, ) -> Result<Vec<Workflow>>
List workflows, optionally filtered by status.
Pass None to return all workflows. Results are ordered by created_at
descending (most recent first). The step_count field is populated.
Full step objects are only fetched by [get_workflow].