-
Notifications
You must be signed in to change notification settings - Fork 11
/
lib.rs
20 lines (18 loc) · 856 Bytes
/
lib.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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.
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
}
}