Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor exports from sdk #270

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion crates/file-server/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,8 @@ async fn main() {
.await
.expect(&format!("failed to listen on {address}"));
tracing::info!("file server started on {}", listener.local_addr().unwrap());
axum::serve(listener, app).await.unwrap()

axum::serve(listener, app).await.unwrap();
}

async fn upload(
Expand Down
1 change: 1 addition & 0 deletions crates/provider/src/docker/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ where
provider
}

/// Set tmp_dir to use as base for the provider
pub fn tmp_dir(mut self, tmp_dir: impl Into<PathBuf>) -> Self {
self.tmp_dir = tmp_dir.into();
self
Expand Down
1 change: 1 addition & 0 deletions crates/provider/src/kubernetes/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ where
})
}

/// Set tmp_dir to use as base for the provider
pub fn tmp_dir(mut self, tmp_dir: impl Into<PathBuf>) -> Self {
self.tmp_dir = tmp_dir.into();
self
Expand Down
1 change: 1 addition & 0 deletions crates/provider/src/native/provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ where
})
}

/// Set tmp_dir to use as base for the provider
pub fn tmp_dir(mut self, tmp_dir: impl Into<PathBuf>) -> Self {
self.tmp_dir = tmp_dir.into();
self
Expand Down
50 changes: 44 additions & 6 deletions crates/sdk/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,26 +1,64 @@
use async_trait::async_trait;
pub use configuration::{NetworkConfig, NetworkConfigBuilder, RegistrationStrategy};
#[cfg(feature = "pjs")]
pub use orchestrator::pjs_helper::PjsResult;
#[deprecated]
pub use configuration::RegistrationStrategy;
// Top level access to sdk
pub use configuration::{NetworkConfig, NetworkConfigBuilder};
// Orchestrator (TODO: export using orchestrator scope)
pub use orchestrator::{
errors::OrchestratorError,
network::{node::NetworkNode, Network},
AddCollatorOptions, AddNodeOptions, Orchestrator,
};

// Providers list
pub const PROVIDERS: [&str; 3] = ["k8s", "native", "docker"];
// Allow to create single provider from sdk
pub mod provider {
pub use provider::{
DockerProvider, DynNamespace, DynNode, DynProvider, KubernetesProvider, NativeProvider,
};
}

#[cfg(feature = "pjs")]
pub use orchestrator::pjs_helper::PjsResult;

// Helpers used for interact with the network
pub mod tx_helper {
pub use orchestrator::{
network::chain_upgrade::ChainUpgrade, shared::types::RuntimeUpgradeOptions,
// Runtime upgrade call
network::chain_upgrade::ChainUpgrade,
shared::types::RuntimeUpgradeOptions,
};
}

use provider::{DockerProvider, KubernetesProvider, NativeProvider};
// Shared type from other crates
pub mod shared {
pub mod configuration {
// Allow to construct config types
pub use configuration::{
shared::types::{Arg, AssetLocation},
RegistrationStrategy,
}; // TODO: move to shared
}

pub mod provider {
pub use provider::shared::types::{
ExecutionResult, RunCommandOptions, RunScriptOptions, SpawnNodeOptions,
};
}

pub mod support {
pub use support::net;
}
}

// LocalFileSystem used by orchestrator/provider
pub use support::fs::local::LocalFileSystem;

/// Environment helper
pub mod environment;
pub const PROVIDERS: [&str; 3] = ["k8s", "native", "docker"];

use provider::{DockerProvider, KubernetesProvider, NativeProvider};
#[async_trait]
pub trait NetworkConfigExt {
/// Spawns a network using the native or k8s provider.
Expand Down
Loading