ui_automata/plan.rs
1use std::time::Duration;
2
3use crate::{RecoveryHandler, RetryPolicy, Step};
4
5pub const DEFAULT_TIMEOUT: Duration = Duration::from_secs(10);
6
7/// An ordered sequence of steps toward a single goal, with local recovery handlers.
8///
9/// `Plan` borrows its steps, name, and unmount list from the owner (typically a
10/// `YamlActionPhase`). This means phases are never consumed and backward `go_to`
11/// jumps in flow-control loops just work.
12pub struct Plan<'a> {
13 /// Human-readable name shown in logs (e.g. `"open_file"`).
14 pub name: &'a str,
15
16 /// Steps executed in order.
17 pub steps: &'a [Step],
18
19 /// Recovery handlers checked (before global ones) when a step times out.
20 pub recovery_handlers: Vec<RecoveryHandler>,
21
22 /// Maximum number of recovery handler firings across all steps in this plan.
23 pub max_recoveries: u32,
24
25 /// Anchor names to unmount after the plan finishes (success or failure).
26 pub unmount: &'a [String],
27
28 /// Timeout applied to steps that do not specify their own `timeout_secs`.
29 pub default_timeout: Duration,
30
31 /// Retry policy applied to steps that do not specify their own `retry`.
32 pub default_retry: RetryPolicy,
33}