rename some event attributes
All checks were successful
Run Check Script / check (pull_request) Successful in -38s

This commit is contained in:
Ian Letourneau 2025-07-31 09:24:05 -04:00
parent 507556969a
commit 6b36b1c7e9
4 changed files with 16 additions and 13 deletions

View File

@ -2,26 +2,26 @@ use log::debug;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use tokio::sync::broadcast; use tokio::sync::broadcast;
use super::interpret::{InterpretError, InterpretStatus, Outcome}; use super::interpret::{InterpretError, Outcome};
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub enum HarmonyEvent { pub enum HarmonyEvent {
HarmonyStarted, HarmonyStarted,
PrepareTopologyStarted { PrepareTopologyStarted {
name: String, topology: String,
}, },
TopologyPrepared { TopologyPrepared {
name: String, topology: String,
outcome: Outcome, outcome: Outcome,
}, },
InterpretExecutionStarted { InterpretExecutionStarted {
name: String,
topology: String, topology: String,
interpret: String,
message: String, message: String,
}, },
InterpretExecutionFinished { InterpretExecutionFinished {
topology: String, topology: String,
name: String, interpret: String,
outcome: Result<Outcome, InterpretError>, outcome: Result<Outcome, InterpretError>,
}, },
} }

View File

@ -43,14 +43,14 @@ impl<T: Topology> Maestro<T> {
/// Delegates the readiness check and potential setup actions to the Topology. /// Delegates the readiness check and potential setup actions to the Topology.
pub async fn prepare_topology(&self) -> Result<Outcome, InterpretError> { pub async fn prepare_topology(&self) -> Result<Outcome, InterpretError> {
instrumentation::instrument(HarmonyEvent::PrepareTopologyStarted { instrumentation::instrument(HarmonyEvent::PrepareTopologyStarted {
name: self.topology.name().to_string(), topology: self.topology.name().to_string(),
}) })
.unwrap(); .unwrap();
let outcome = self.topology.ensure_ready().await?; let outcome = self.topology.ensure_ready().await?;
instrumentation::instrument(HarmonyEvent::TopologyPrepared { instrumentation::instrument(HarmonyEvent::TopologyPrepared {
name: self.topology.name().to_string(), topology: self.topology.name().to_string(),
outcome: outcome.clone(), outcome: outcome.clone(),
}) })
.unwrap(); .unwrap();

View File

@ -55,7 +55,7 @@ impl<T: Topology> Interpret<T> for K3dInstallationInterpret {
) -> Result<Outcome, InterpretError> { ) -> Result<Outcome, InterpretError> {
instrumentation::instrument(HarmonyEvent::InterpretExecutionStarted { instrumentation::instrument(HarmonyEvent::InterpretExecutionStarted {
topology: topology.name().into(), topology: topology.name().into(),
name: "k3d-installation".into(), interpret: "k3d-installation".into(),
message: "installing k3d...".into(), message: "installing k3d...".into(),
}) })
.unwrap(); .unwrap();
@ -77,7 +77,7 @@ impl<T: Topology> Interpret<T> for K3dInstallationInterpret {
instrumentation::instrument(HarmonyEvent::InterpretExecutionFinished { instrumentation::instrument(HarmonyEvent::InterpretExecutionFinished {
topology: topology.name().into(), topology: topology.name().into(),
name: "k3d-installation".into(), interpret: "k3d-installation".into(),
outcome: outcome.clone(), outcome: outcome.clone(),
}) })
.unwrap(); .unwrap();

View File

@ -47,14 +47,17 @@ async fn handle_events() {
match event { match event {
HarmonyEvent::HarmonyStarted => {} HarmonyEvent::HarmonyStarted => {}
HarmonyEvent::PrepareTopologyStarted { name } => { HarmonyEvent::PrepareTopologyStarted { topology: name } => {
let section = progress::new_section(format!( let section = progress::new_section(format!(
"{} Preparing environment: {name}...", "{} Preparing environment: {name}...",
crate::theme::EMOJI_TOPOLOGY, crate::theme::EMOJI_TOPOLOGY,
)); ));
(*sections).insert(name, section); (*sections).insert(name, section);
} }
HarmonyEvent::TopologyPrepared { name, outcome } => { HarmonyEvent::TopologyPrepared {
topology: name,
outcome,
} => {
let section = (*sections).get(&name).unwrap(); let section = (*sections).get(&name).unwrap();
let progress = progress::add_spinner(section, "".into()); let progress = progress::add_spinner(section, "".into());
@ -74,7 +77,7 @@ async fn handle_events() {
} }
} }
HarmonyEvent::InterpretExecutionStarted { HarmonyEvent::InterpretExecutionStarted {
name, interpret: name,
topology, topology,
message, message,
} => { } => {
@ -85,7 +88,7 @@ async fn handle_events() {
} }
HarmonyEvent::InterpretExecutionFinished { HarmonyEvent::InterpretExecutionFinished {
topology, topology,
name, interpret: name,
outcome, outcome,
} => { } => {
let section = (*sections).get(&topology).unwrap(); let section = (*sections).get(&topology).unwrap();