Skip to content

Commit

Permalink
Only enable storage monitor on Unix-like OS
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Feb 27, 2023
1 parent 165e946 commit 78efd83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion crates/subspace-node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ sc-consensus-subspace = { version = "0.1.0", path = "../sc-consensus-subspace" }
sc-subspace-chain-specs = { version = "0.1.0", path = "../sc-subspace-chain-specs" }
sc-executor = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "50fdd4fd3853b15c019fc96a0eb7dbffe1ff042c" }
sc-service = { version = "0.10.0-dev", git = "https://github.com/subspace/substrate", rev = "50fdd4fd3853b15c019fc96a0eb7dbffe1ff042c", default-features = false }
sc-storage-monitor = { version = "0.1.0", git = "https://github.com/subspace/substrate", rev = "50fdd4fd3853b15c019fc96a0eb7dbffe1ff042c", default-features = false }
sc-telemetry = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "50fdd4fd3853b15c019fc96a0eb7dbffe1ff042c" }
sc-tracing = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "50fdd4fd3853b15c019fc96a0eb7dbffe1ff042c" }
sc-utils = { version = "4.0.0-dev", git = "https://github.com/subspace/substrate", rev = "50fdd4fd3853b15c019fc96a0eb7dbffe1ff042c" }
Expand All @@ -64,6 +63,10 @@ system-domain-runtime = { version = "0.1.0", path = "../../domains/runtime/syste
thiserror = "1.0.38"
tokio = "1.25.0"

# TODO: Convert to regular dependency once https://github.com/paritytech/substrate/pull/13466 is in our fork
[target.'cfg(unix)'.dependencies]
sc-storage-monitor = { version = "0.1.0", git = "https://github.com/subspace/substrate", rev = "50fdd4fd3853b15c019fc96a0eb7dbffe1ff042c", default-features = false }

[build-dependencies]
substrate-build-script-utils = { version = "3.0.0", git = "https://github.com/subspace/substrate", rev = "50fdd4fd3853b15c019fc96a0eb7dbffe1ff042c" }

Expand Down
3 changes: 3 additions & 0 deletions crates/subspace-node/src/bin/subspace-node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ use sc_cli::{ChainSpec, CliConfiguration, SubstrateCli};
use sc_consensus_slots::SlotProportion;
use sc_executor::NativeExecutionDispatch;
use sc_service::PartialComponents;
#[cfg(unix)]
use sc_storage_monitor::StorageMonitorService;
use sc_subspace_chain_specs::ExecutionChainSpec;
use sc_utils::mpsc::tracing_unbounded;
Expand Down Expand Up @@ -362,6 +363,7 @@ fn main() -> Result<(), Error> {
set_default_ss58_version(&runner.config().chain_spec);
runner.run_node_until_exit(|primary_chain_config| async move {
let tokio_handle = primary_chain_config.tokio_handle.clone();
#[cfg(unix)]
let database_source = primary_chain_config.database.clone();

let maybe_system_domain_chain_spec = primary_chain_config
Expand Down Expand Up @@ -477,6 +479,7 @@ fn main() -> Result<(), Error> {
})?
};

#[cfg(unix)]
StorageMonitorService::try_spawn(
cli.storage_monitor,
database_source,
Expand Down
2 changes: 2 additions & 0 deletions crates/subspace-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use clap::Parser;
use sc_cli::{RunCmd, SubstrateCli};
use sc_executor::{NativeExecutionDispatch, RuntimeVersion};
use sc_service::ChainSpec;
#[cfg(unix)]
use sc_storage_monitor::StorageMonitorParams;
use sc_subspace_chain_specs::ConsensusChainSpec;
use sc_telemetry::serde_json;
Expand Down Expand Up @@ -224,6 +225,7 @@ pub struct Cli {
pub domain_args: Vec<String>,

/// Parameters used to create the storage monitor.
#[cfg(unix)]
#[clap(flatten)]
pub storage_monitor: StorageMonitorParams,
}
Expand Down

0 comments on commit 78efd83

Please sign in to comment.