Skip to main content

Step

Trait Step 

Source
pub trait Step: Send + Sync {
    // Required methods
    fn id(&self) -> &'static str;
    fn title(&self) -> &'static str;
    fn reference_script(&self) -> &'static str;
    fn step_version(&self) -> u32;
    fn is_done(&self, ctx: &HostContext) -> bool;
    fn plan(&self, ctx: &mut HostContext) -> Result<Vec<PlannedAction>>;
    fn apply(&self, ctx: &mut HostContext) -> Result<()>;

    // Provided methods
    fn schema_version(&self) -> u32 { ... }
    fn depends_on(&self) -> &'static [&'static str] { ... }
    fn needs_reboot_after(&self) -> bool { ... }
    fn destructive(&self) -> bool { ... }
}
Expand description

One setup / ops step. Implemented by isolated modules under steps/.

Steps are versioned (step_version) and may declare dependencies (depends_on). Surfaces call crate::setup_run / crate::setup_step rather than steps directly.

Required Methods§

Source

fn id(&self) -> &'static str

Stable short id (s1, m1, d1, …).

Source

fn title(&self) -> &'static str

Human-readable title for TUI / status.

Source

fn reference_script(&self) -> &'static str

Legacy shell script this step absorbs (documentation / tip-sync).

Source

fn step_version(&self) -> u32

Implementation version; resume marks stale when this increases.

Source

fn is_done(&self, ctx: &HostContext) -> bool

Heuristic: already completed on this host layout.

Source

fn plan(&self, ctx: &mut HostContext) -> Result<Vec<PlannedAction>>

Record planned actions without mutating the host (also used in dry-run apply).

§Errors

Returns crate::HortoError when planning cannot inspect host state or build the action list.

Source

fn apply(&self, ctx: &mut HostContext) -> Result<()>

Execute or plan according to HostContext::mode.

§Errors

Returns crate::HortoError when apply fails (I/O, missing deps, cancelled confirms, …).

Provided Methods§

Source

fn schema_version(&self) -> u32

Schema of the step trait itself (rarely bumped).

Source

fn depends_on(&self) -> &'static [&'static str]

Step ids that must be Done before this step may run.

Source

fn needs_reboot_after(&self) -> bool

Advise a reboot after a successful apply.

Source

fn destructive(&self) -> bool

True when apply can overwrite live host config.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§