use async_trait::async_trait;
pub use configuration::{NetworkConfig, NetworkConfigBuilder, RegistrationStrategy};
#[cfg(feature = "pjs")]
pub use orchestrator::pjs_helper::PjsResult;
pub use orchestrator::{
errors::OrchestratorError,
network::{node::NetworkNode, Network},
AddCollatorOptions, AddNodeOptions, Orchestrator,
};
pub mod tx_helper {
pub use orchestrator::{
network::chain_upgrade::ChainUpgrade, shared::types::RuntimeUpgradeOptions,
};
}
use provider::{DockerProvider, KubernetesProvider, NativeProvider};
pub use support::fs::local::LocalFileSystem;
pub mod environment;
pub const PROVIDERS: [&str; 3] = ["k8s", "native", "docker"];
#[async_trait]
pub trait NetworkConfigExt {
async fn spawn_native(self) -> Result<Network<LocalFileSystem>, OrchestratorError>;
async fn spawn_k8s(self) -> Result<Network<LocalFileSystem>, OrchestratorError>;
async fn spawn_docker(self) -> Result<Network<LocalFileSystem>, OrchestratorError>;
}
#[async_trait]
impl NetworkConfigExt for NetworkConfig {
async fn spawn_native(self) -> Result<Network<LocalFileSystem>, OrchestratorError> {
let filesystem = LocalFileSystem;
let provider = NativeProvider::new(filesystem.clone());
let orchestrator = Orchestrator::new(filesystem, provider);
orchestrator.spawn(self).await
}
async fn spawn_k8s(self) -> Result<Network<LocalFileSystem>, OrchestratorError> {
let filesystem = LocalFileSystem;
let provider = KubernetesProvider::new(filesystem.clone()).await;
let orchestrator = Orchestrator::new(filesystem, provider);
orchestrator.spawn(self).await
}
async fn spawn_docker(self) -> Result<Network<LocalFileSystem>, OrchestratorError> {
let filesystem = LocalFileSystem;
let provider = DockerProvider::new(filesystem.clone()).await;
let orchestrator = Orchestrator::new(filesystem, provider);
orchestrator.spawn(self).await
}
}