-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feat/add-tracing
- Loading branch information
Showing
12 changed files
with
97 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
[package] | ||
name = "zombienet-sdk" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
configuration = { path = "../configuration" } | ||
orchestrator = { path = "../orchestrator" } | ||
provider = { path = "../provider" } | ||
support = { path = "../support" } | ||
async-trait = { workspace = true } | ||
tokio = { workspace = true } | ||
futures = { workspace = true } | ||
subxt = { workspace = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
use async_trait::async_trait; | ||
pub use configuration::{NetworkConfig, NetworkConfigBuilder, RegistrationStrategy}; | ||
pub use orchestrator::{errors::OrchestratorError, network::Network, AddNodeOpts, Orchestrator}; | ||
use provider::NativeProvider; | ||
use support::{fs::local::LocalFileSystem, process::os::OsProcessManager}; | ||
|
||
#[async_trait] | ||
pub trait NetworkConfigExt { | ||
/// Spawns a network using the native provider. | ||
/// | ||
/// # Example: | ||
/// ```rust | ||
/// # use zombienet_sdk::{NetworkConfig, NetworkConfigExt}; | ||
/// # async fn example() -> Result<(), zombienet_sdk::OrchestratorError> { | ||
/// let network = NetworkConfig::load_from_toml("config.toml")? | ||
/// .spawn_native() | ||
/// .await?; | ||
/// # Ok(()) | ||
/// # } | ||
/// ``` | ||
async fn spawn_native(self) -> Result<Network<LocalFileSystem>, OrchestratorError>; | ||
} | ||
|
||
#[async_trait] | ||
impl NetworkConfigExt for NetworkConfig { | ||
async fn spawn_native(self) -> Result<Network<LocalFileSystem>, OrchestratorError> { | ||
let provider = NativeProvider::new(LocalFileSystem {}, OsProcessManager {}); | ||
let orchestrator = Orchestrator::new(LocalFileSystem {}, provider); | ||
orchestrator.spawn(self).await | ||
} | ||
} |