breaking: Rename Maestro::new to Maestro::new_without_initialization. This improves UX as it makes it more obvious to users that this method should rarely be used
All checks were successful
Run Check Script / check (pull_request) Successful in -5s

This commit is contained in:
Jean-Gabriel Gill-Couture 2025-07-02 17:47:23 -04:00
parent a4aa685a4f
commit 6371009c6f
5 changed files with 15 additions and 8 deletions

View File

@ -16,12 +16,16 @@ async fn main() {
let app = RustWebappScore {
name: "Example Rust Webapp".to_string(),
domain: Url::Url(url::Url::parse("https://rustapp.harmony.example.com").unwrap()),
features: vec![Box::new(ContinuousDelivery { application: Arc::new(application.clone()) })],
features: vec![Box::new(ContinuousDelivery {
application: Arc::new(application.clone()),
})],
application,
};
let topology = K8sAnywhereTopology::from_env();
let mut maestro = Maestro::initialize(Inventory::autoload(), topology).await.unwrap();
let mut maestro = Maestro::initialize(Inventory::autoload(), topology)
.await
.unwrap();
maestro.register_all(vec![Box::new(app)]);
harmony_cli::init(maestro, None).await.unwrap();
}

View File

@ -19,7 +19,10 @@ pub struct Maestro<T: Topology> {
}
impl<T: Topology> Maestro<T> {
fn new(inventory: Inventory, topology: T) -> Self {
/// Creates a bare maestro without initialization.
///
/// This should rarely be used. Most of the time Maestro::initialize should be used instead.
pub fn new_without_initialization(inventory: Inventory, topology: T) -> Self {
Self {
inventory,
topology,
@ -29,7 +32,7 @@ impl<T: Topology> Maestro<T> {
}
pub async fn initialize(inventory: Inventory, topology: T) -> Result<Self, InterpretError> {
let instance = Self::new(inventory, topology);
let instance = Self::new_without_initialization(inventory, topology);
instance.prepare_topology().await?;
Ok(instance)
}

View File

@ -1,12 +1,12 @@
mod feature;
pub mod features;
mod rust;
pub mod oci;
mod rust;
use std::sync::Arc;
pub use oci::*;
pub use feature::*;
use log::info;
pub use oci::*;
pub use rust::*;
use async_trait::async_trait;

View File

@ -153,7 +153,7 @@ mod test {
fn init_test_maestro() -> Maestro<HAClusterTopology> {
let inventory = Inventory::autoload();
let topology = HAClusterTopology::autoload();
let mut maestro = Maestro::new(inventory, topology);
let mut maestro = Maestro::new_without_initialization(inventory, topology);
maestro.register_all(vec![
Box::new(SuccessScore {}),

View File

@ -41,7 +41,7 @@ pub mod tui {
/// async fn main() {
/// let inventory = Inventory::autoload();
/// let topology = HAClusterTopology::autoload();
/// let mut maestro = Maestro::new(inventory, topology);
/// let mut maestro = Maestro::new_without_initialization(inventory, topology);
///
/// maestro.register_all(vec![
/// Box::new(SuccessScore {}),