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 tokio::sync::broadcast;
use super::interpret::{InterpretError, InterpretStatus, Outcome};
use super::interpret::{InterpretError, Outcome};
#[derive(Debug, Clone)]
pub enum HarmonyEvent {
HarmonyStarted,
PrepareTopologyStarted {
name: String,
topology: String,
},
TopologyPrepared {
name: String,
topology: String,
outcome: Outcome,
},
InterpretExecutionStarted {
name: String,
topology: String,
interpret: String,
message: String,
},
InterpretExecutionFinished {
topology: String,
name: String,
interpret: String,
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.
pub async fn prepare_topology(&self) -> Result<Outcome, InterpretError> {
instrumentation::instrument(HarmonyEvent::PrepareTopologyStarted {
name: self.topology.name().to_string(),
topology: self.topology.name().to_string(),
})
.unwrap();
let outcome = self.topology.ensure_ready().await?;
instrumentation::instrument(HarmonyEvent::TopologyPrepared {
name: self.topology.name().to_string(),
topology: self.topology.name().to_string(),
outcome: outcome.clone(),
})
.unwrap();

View File

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

View File

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