apalis_workflow/context.rs
1use serde::{Deserialize, Serialize};
2
3/// Context information for the current step in the workflow
4#[derive(Debug, Clone)]
5pub struct StepContext<Backend> {
6 /// Index of the current step
7 pub current_step: usize,
8 /// Backend associated with the current step
9 pub backend: Backend,
10 /// Indicates if there is a next step
11 pub has_next: bool,
12}
13impl<B> StepContext<B> {
14 /// Creates a new StepContext
15 pub fn new(backend: B, idx: usize, has_next: bool) -> Self {
16 Self {
17 current_step: idx,
18 backend,
19 has_next,
20 }
21 }
22}
23
24/// Metadata stored in each task for workflow processing
25#[derive(Debug, Clone, Deserialize, Serialize, Default)]
26pub struct WorkflowContext {
27 /// Index of the step in the workflow
28 pub step_index: usize,
29 // / Additional fields can be added as needed
30 // / name: String,
31 // / version: String,
32 // / parent_workflow_id: Option<String>,
33}