forked from NationTech/harmony
Introduce the `Topology` trait to ensure that `Maestro` can compile-time safely bind compatible `Scores` and `Topologies`. This refactoring includes updating `HarmonyTuiEvent`, `ScoreListWidget`, and related structures to work with generic `Topology` types, enhancing type safety and modularity.
24 lines
595 B
Rust
24 lines
595 B
Rust
use harmony::{
|
|
inventory::Inventory,
|
|
maestro::Maestro,
|
|
modules::{
|
|
dummy::{ErrorScore, PanicScore, SuccessScore},
|
|
k8s::deployment::K8sDeploymentScore,
|
|
},
|
|
topology::HAClusterTopology,
|
|
};
|
|
|
|
#[tokio::main]
|
|
async fn main() {
|
|
let inventory = Inventory::autoload();
|
|
let topology = HAClusterTopology::autoload();
|
|
let mut maestro = Maestro::new(inventory, topology);
|
|
|
|
maestro.register_all(vec![
|
|
Box::new(SuccessScore {}),
|
|
Box::new(ErrorScore {}),
|
|
Box::new(PanicScore {}),
|
|
]);
|
|
harmony_tui::init(maestro).await.unwrap();
|
|
}
|