mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +00:00
Remove node-service (#933)
* Move `chain_spec` into `node-cli` * Fixes tests * Adds `construct_simple_service` and `construct_service_factory` macros * Remove the `node-service` crate * Add some documentation * Fixes compilation on stable
This commit is contained in:
@@ -22,17 +22,32 @@
|
||||
extern crate tokio;
|
||||
|
||||
extern crate substrate_cli as cli;
|
||||
extern crate node_service as service;
|
||||
extern crate substrate_primitives as primitives;
|
||||
extern crate node_runtime;
|
||||
extern crate exit_future;
|
||||
#[macro_use]
|
||||
extern crate hex_literal;
|
||||
#[cfg(test)]
|
||||
extern crate substrate_service_test as service_test;
|
||||
extern crate substrate_transaction_pool as transaction_pool;
|
||||
extern crate substrate_network as network;
|
||||
extern crate node_network;
|
||||
extern crate sr_primitives as runtime_primitives;
|
||||
extern crate node_primitives;
|
||||
#[macro_use]
|
||||
extern crate substrate_service;
|
||||
extern crate node_executor;
|
||||
|
||||
#[macro_use]
|
||||
extern crate log;
|
||||
|
||||
pub use cli::error;
|
||||
mod chain_spec;
|
||||
mod service;
|
||||
|
||||
use tokio::runtime::Runtime;
|
||||
pub use service::{Components as ServiceComponents, Service, CustomConfiguration, ServiceFactory};
|
||||
pub use cli::{VersionInfo, IntoExit};
|
||||
use substrate_service::{ServiceFactory, Roles as ServiceRoles};
|
||||
|
||||
/// The chain specification option.
|
||||
#[derive(Clone, Debug)]
|
||||
@@ -49,12 +64,12 @@ pub enum ChainSpec {
|
||||
|
||||
/// Get a chain config from a spec setting.
|
||||
impl ChainSpec {
|
||||
pub(crate) fn load(self) -> Result<service::ChainSpec, String> {
|
||||
pub(crate) fn load(self) -> Result<chain_spec::ChainSpec, String> {
|
||||
Ok(match self {
|
||||
ChainSpec::BbqBirch => service::chain_spec::bbq_birch_config()?,
|
||||
ChainSpec::Development => service::chain_spec::development_config(),
|
||||
ChainSpec::LocalTestnet => service::chain_spec::local_testnet_config(),
|
||||
ChainSpec::StagingTestnet => service::chain_spec::staging_testnet_config(),
|
||||
ChainSpec::BbqBirch => chain_spec::bbq_birch_config()?,
|
||||
ChainSpec::Development => chain_spec::development_config(),
|
||||
ChainSpec::LocalTestnet => chain_spec::local_testnet_config(),
|
||||
ChainSpec::StagingTestnet => chain_spec::staging_testnet_config(),
|
||||
})
|
||||
}
|
||||
|
||||
@@ -69,7 +84,7 @@ impl ChainSpec {
|
||||
}
|
||||
}
|
||||
|
||||
fn load_spec(id: &str) -> Result<Option<service::ChainSpec>, String> {
|
||||
fn load_spec(id: &str) -> Result<Option<chain_spec::ChainSpec>, String> {
|
||||
Ok(match ChainSpec::from(id) {
|
||||
Some(spec) => Some(spec.load()?),
|
||||
None => None,
|
||||
@@ -93,7 +108,7 @@ pub fn run<I, T, E>(args: I, exit: E, version: cli::VersionInfo) -> error::Resul
|
||||
info!("Roles: {:?}", config.roles);
|
||||
let mut runtime = Runtime::new()?;
|
||||
let executor = runtime.executor();
|
||||
match config.roles == service::Roles::LIGHT {
|
||||
match config.roles == ServiceRoles::LIGHT {
|
||||
true => run_until_exit(&mut runtime, service::Factory::new_light(config, executor)?, exit)?,
|
||||
false => run_until_exit(&mut runtime, service::Factory::new_full(config, executor)?, exit)?,
|
||||
}
|
||||
@@ -108,7 +123,7 @@ fn run_until_exit<C, E>(
|
||||
e: E,
|
||||
) -> error::Result<()>
|
||||
where
|
||||
C: service::Components,
|
||||
C: substrate_service::Components,
|
||||
E: IntoExit,
|
||||
{
|
||||
let (exit_send, exit) = exit_future::signal();
|
||||
|
||||
Reference in New Issue
Block a user